Affected page
https://www.php.net/manual/en/function.class-exists.php
Issue description
class_exists will throw if a class is autoloaded (= 2nd arg is true = default!), but any extends/implements of that class do not exist and cannot be autoloaded
Steps to reproduce
spl_autoload_register( function ( $class_name ) {
if ( $class_name === 'Foo' ) {
require __DIR__ . '/foo.php';
}
} );
class_exists( Foo::class );
foo.php
Suggested fix
Mention that it can throw an exception if the any of the classes that class extends/implements fails
Mention that it will result in a fatal E_ERROR if any of the "trait use" of the class do not exist (php/php-src#21106)
Affected page
https://www.php.net/manual/en/function.class-exists.php
Issue description
class_exists will throw if a class is autoloaded (= 2nd arg is true = default!), but any extends/implements of that class do not exist and cannot be autoloaded
Steps to reproduce
foo.php
Suggested fix
Mention that it can throw an exception if the any of the classes that class extends/implements fails
Mention that it will result in a fatal E_ERROR if any of the "trait use" of the class do not exist (php/php-src#21106)