1
0
mirror of https://github.com/php/php-src.git synced 2026-03-25 16:52:18 +01:00
Files
archived-php-src/ext/spl/tests/bug71236.phpt
Nikita Popov 5b59d4915c Cleanup SPL autoload implementation
Replace EG(autoload_func) with a C level zend_autoload hook.
This avoids having to do one indirection through PHP function
calls. The need for EG(autoload_func) was a leftover from the
__autoload() implementation.

Additionally, drop special-casing of spl_autoload(), and instead
register it just like any other autoloading function. This fixes
bug #71236 as a side-effect.

Finally, change spl_autoload_functions() to always return an array.
The distinction between false and an empty array no longer makes
sense here.

Closes GH-5696.
2020-06-10 09:38:47 +02:00

24 lines
410 B
PHP

--TEST--
Bug #71236: Second call of spl_autoload_register() does nothing if it has no arguments
--FILE--
<?php
spl_autoload_register(function ($class) {});
spl_autoload_register();
var_dump(spl_autoload_functions());
?>
--EXPECT--
array(2) {
[0]=>
object(Closure)#1 (1) {
["parameter"]=>
array(1) {
["$class"]=>
string(10) "<required>"
}
}
[1]=>
string(12) "spl_autoload"
}