]> granicus.if.org Git - php/commit
Cleanup SPL autoload implementation
authorNikita Popov <nikita.ppv@gmail.com>
Tue, 9 Jun 2020 15:36:36 +0000 (17:36 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 10 Jun 2020 07:38:47 +0000 (09:38 +0200)
commit5b59d4915cfa7c12ddf65281e4f7f81d6985d27f
tree4985494346993cae84eb4f54969173b19cd7badd
parent68dd6cc92b81cc2253cdfcdc53823ad6527d2e05
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.
15 files changed:
NEWS
Zend/tests/bug49908.phpt
Zend/tests/generators/bug65161.phpt
Zend/tests/type_declarations/variance/loading_exception1.phpt
Zend/tests/type_declarations/variance/loading_exception2.phpt
Zend/tests/use_unlinked_class.phpt
Zend/zend_execute.h
Zend/zend_execute_API.c
Zend/zend_globals.h
ext/spl/php_spl.c
ext/spl/php_spl.stub.php
ext/spl/php_spl_arginfo.h
ext/spl/tests/bug71236.phpt [new file with mode: 0644]
ext/spl/tests/spl_autoload_002.phpt
ext/spl/tests/spl_autoload_012.phpt