mirror of
https://github.com/php/php-src.git
synced 2025-08-15 13:38:49 +02:00
ext/spl: Deprecate passing spl_autoload_call() to spl_autoload_unregister() (#19422)
RFC: https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_passing_spl_autoload_call_to_spl_autoload_unregister
This commit is contained in:
parent
94a15cc92f
commit
8c5c03e33a
4 changed files with 15 additions and 2 deletions
|
@ -582,6 +582,13 @@ PHP_FUNCTION(spl_autoload_unregister)
|
|||
|
||||
if (fcc.function_handler && zend_string_equals_literal(
|
||||
fcc.function_handler->common.function_name, "spl_autoload_call")) {
|
||||
php_error_docref(NULL, E_DEPRECATED,
|
||||
"Using spl_autoload_call() as a callback for spl_autoload_unregister() is deprecated,"
|
||||
" to remove all registered autoloaders, call spl_autoload_unregister()"
|
||||
" for all values returned from spl_autoload_functions()");
|
||||
if (UNEXPECTED(EG(exception))) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
if (spl_autoload_functions) {
|
||||
/* Don't destroy the hash table, as we might be iterating over it right now. */
|
||||
zend_hash_clean(spl_autoload_functions);
|
||||
|
|
|
@ -13,6 +13,8 @@ spl_autoload_register(function ($name) {
|
|||
new A();
|
||||
?>
|
||||
--EXPECTF--
|
||||
Deprecated: spl_autoload_unregister(): Using spl_autoload_call() as a callback for spl_autoload_unregister() is deprecated, to remove all registered autoloaders, call spl_autoload_unregister() for all values returned from spl_autoload_functions() in %s on line %d
|
||||
|
||||
Fatal error: Uncaught Error: Class "A" not found in %s:%d
|
||||
Stack trace:
|
||||
#0 {main}
|
||||
|
|
|
@ -35,7 +35,7 @@ spl_autoload_unregister('spl_autoload');
|
|||
var_dump(spl_autoload_functions());
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
array(0) {
|
||||
}
|
||||
array(1) {
|
||||
|
@ -56,6 +56,8 @@ array(2) {
|
|||
[1]=>
|
||||
string(16) "SplAutoloadTest2"
|
||||
}
|
||||
|
||||
Deprecated: spl_autoload_unregister(): Using spl_autoload_call() as a callback for spl_autoload_unregister() is deprecated, to remove all registered autoloaders, call spl_autoload_unregister() for all values returned from spl_autoload_functions() in %s on line %d
|
||||
array(0) {
|
||||
}
|
||||
array(1) {
|
||||
|
|
|
@ -5,6 +5,8 @@ spl_autoload_unregister("spl_autoload_call") without registrations
|
|||
var_dump(spl_autoload_unregister("spl_autoload_call"));
|
||||
?>
|
||||
Done
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
|
||||
Deprecated: spl_autoload_unregister(): Using spl_autoload_call() as a callback for spl_autoload_unregister() is deprecated, to remove all registered autoloaders, call spl_autoload_unregister() for all values returned from spl_autoload_functions() in %s on line %d
|
||||
bool(true)
|
||||
Done
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue