Edit report at https://bugs.php.net/bug.php?id=79992&edit=1
ID: 79992
User updated by: ASchmidt at Anamera dot net
Reported by: ASchmidt at Anamera dot net
Summary: register_shutdown_function(): Invalid shutdown
callback
-Status: Feedback
+Status: Assigned
Type: Bug
Package: opcache
Operating System: Windows x64 IIS
PHP Version: 7.4.9
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
As requested, I've set up a fresh PHP 7.4.9 instance, empty PHP.ini, and a fresh web site.
Along the way I stumbled across more places where classes supposedly don't exist and after a
day of banging my head against walls everywhere, was able to extract it down to one simple/mininal
case -- with huge impact.
It appears that any subclasses that are defined BEFORE the parent class could be referenced in code
prior to the class definitions under 7.3.21 - but will NOW FAIL as non-existing in 7.4.9.
I don't know yet, if THIS is the root cause - but I'll report the following separately as
a 7.4.9 problem. I'll keep testing... but this may not be an OpCache-specific problem:
<?php
declare(strict_types=1);
var_dump( class_exists( 'MySubclass1' ), class_exists( 'MySubclass2' ),
class_exists( 'MyAbstract' ) ); // PHP 7.4.9 = FALSE, true, true (PHP 7.3.21 = TRUE,
true, true)
class MySubclass1 extends MyAbstract{}
abstract class MyAbstract{}
class MySubclass2 extends MyAbstract{}
var_dump( class_exists( 'MySubclass1' ), class_exists( 'MySubclass2' ),
class_exists( 'MyAbstract' ) ); // true, true, true
// Produced with empty php.ini !
Previous Comments:
------------------------------------------------------------------------
[2020-08-19 09:18:40] cmb@php.net
I can not reproduce this with opcache-gui-2.5.4 (haven't tried
with Wordpress). Could you please provide a minimal php.ini with
which you can reproduce the issue (i.e. start with an empty
php.ini, and just add the necessary settings). Also, does the
OPcache error log provide any insights (opcache.error_log set, and
opcache.log_verbosity_level=4)?
------------------------------------------------------------------------
[2020-08-18 23:30:08] ASchmidt at Anamera dot net
I have spent the afternoon attempting to narrow this down - I tested with 7.4.8 and even 7.4.6 - and
the problem persists.
I then took WordPress out of the picture, and just used the single-script OpCache GUI
(https://github.com/amnuts/opcache-gui/releases/). That script will load ONCE, display valid figures
and after it ran once, FastCGI will fail on page refresh.
I have attempted adding a Cache_ID, using the CWD option, setting up a different IIS application
pool just for that one test site. Nothing makes a difference. The ONLY two things that work are -
switch that site to run through PHP 7.3.21, or disable opcache. Only then will the OpCache GUI
project and/or WordPress 5.5 run.
Right now the problem looks like a general/generic problem with OpCache under 7.4 on IIS FCGI, but I
realize that this is not a likely scenario to not have long since been encountered.
------------------------------------------------------------------------
[2020-08-18 20:50:40] ASchmidt at Anamera dot net
Description:
------------
register_shutdown_function for existing class method will result in warning
"PHP Warning: register_shutdown_function(): Invalid shutdown callback"
In two other scenarios, existing instance method is reported as non-existing:
"Error: Call to undefined method".
If I disable/bypass the two code sections that reference the existing methods, then the rest of
WordPress will load - or if I disable OPCACHE (or if I disable error reporting).
Happens without any added third party PHP extensions, using a freshly installed WordPress 5.5 on IIS
x64 (FastCGI). Does NOT occur with PHP 7.3.21.
Test script:
---------------
// SCENARIO 1:
if ( ! is_object( $handler ) || ! is_callable( array( $handler, 'handle' ) ) ) {
$handler = new WP_Fatal_Error_Handler();
}
register_shutdown_function( array( $handler, 'handle' ) );
// SCENARIO 2:
if ( WP_DEBUG && WP_DEBUG_DISPLAY ) {
$this->show_errors();
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79992&edit=1