|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2020-08-18 20:50 UTC] 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();
}
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 22:00:02 2025 UTC |
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 !