|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73896 spl_autoload() crashes when calls magic _call()
Submitted: 2017-01-09 12:04 UTC Modified: 2017-01-09 12:05 UTC
From: Assigned: dmitry (profile)
Status: Closed Package: SPL related
PHP Version: 7.0Git-2017-01-09 (Git) OS: *
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
New email:
PHP Version: OS:


 [2017-01-09 12:04 UTC]
The following script crashes on second attempt to call spl_autoload(), because the first attempt destroyed trampoline function. 

Test script:
class Registrator {
    public static function call($callable, array  $args) {
        return call_user_func_array($callable, [$args]);

class teLoader {
    public function __construct() {
        Registrator::call('spl_autoload_register', [$this, 'autoload']);

    public function __call($method, $args) {

    protected function autoload($class) {
    	die("Protected autoload() called!\n");

    public function doSomething() {
        throw new teException();

$teLoader = new teLoader();

try {
	new teChild();
} catch (Throwable $e) {
	echo "Exception: ", $e->getMessage() , "\n";

Expected result:
Exception: Class 'teException' not found

Actual result:
==4663== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==4663==  Access not within mapped region at address 0x5
==4663==    at 0x866E114: ZEND_CALL_TRAMPOLINE_SPEC_HANDLER (zend_vm_execute.h:1974)
==4663==    by 0x866A63A: execute_ex (zend_vm_execute.h:429)
==4663==    by 0x860C079: zend_call_function (zend_execute_API.c:828)
==4663==    by 0x863DD4B: zend_call_method (zend_interfaces.c:101)
==4663==    by 0x8462C20: zif_spl_autoload_call (php_spl.c:408)
==4663==    by 0x860C10E: zend_call_function (zend_execute_API.c:842)
==4663==    by 0x860C611: zend_lookup_class_ex (zend_execute_API.c:1001)
==4663==    by 0x860CF62: zend_fetch_class_by_name (zend_execute_API.c:1436)
==4663==    by 0x866FF76: ZEND_NEW_SPEC_CONST_HANDLER (zend_vm_execute.h:3193)
==4663==    by 0x866A63A: execute_ex (zend_vm_execute.h:429)
==4663==    by 0x860C079: zend_call_function (zend_execute_API.c:828)
==4663==    by 0x863DD4B: zend_call_method (zend_interfaces.c:101)


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-09 12:05 UTC]
-Status: Open +Status: Assigned -Assigned To: +Assigned To: dmitry
 [2017-01-09 12:14 UTC]
Automatic comment on behalf of
Log: Fixed bug #73896 (spl_autoload() crashes when calls magic _call())
 [2017-01-09 12:14 UTC]
-Status: Assigned +Status: Closed
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Tue Jan 28 05:01:24 2020 UTC