{"action":"opened","issue":{"url":"https://api.github.com/repos/facebook/hhvm/issues/5701","labels_url":"https://api.github.com/repos/facebook/hhvm/issues/5701/labels{/name}","comments_url":"https://api.github.com/repos/facebook/hhvm/issues/5701/comments","events_url":"https://api.github.com/repos/facebook/hhvm/issues/5701/events","html_url":"https://github.com/facebook/hhvm/issues/5701","id":95221508,"number":5701,"title":"Registering autoloaders from autoloaders does not as expected","user":{"login":"willemstuursma","id":701299,"avatar_url":"https://avatars.githubusercontent.com/u/701299?v=3","gravatar_id":"","url":"https://api.github.com/users/willemstuursma","html_url":"https://github.com/willemstuursma","followers_url":"https://api.github.com/users/willemstuursma/followers","following_url":"https://api.github.com/users/willemstuursma/following{/other_user}","gists_url":"https://api.github.com/users/willemstuursma/gists{/gist_id}","starred_url":"https://api.github.com/users/willemstuursma/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/willemstuursma/subscriptions","organizations_url":"https://api.github.com/users/willemstuursma/orgs","repos_url":"https://api.github.com/users/willemstuursma/repos","events_url":"https://api.github.com/users/willemstuursma/events{/privacy}","received_events_url":"https://api.github.com/users/willemstuursma/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-07-15T15:20:22Z","updated_at":"2015-07-15T15:20:22Z","closed_at":null,"body":"Imagine a situation where an autoloader does not know how to load a class, but it does know which autoloader does so it registers the new autoloader.\r\n\r\nIn HHVM, registering an autoloader while loading a class using the `spl_autoload_register()` function does not work. The newly registered autoloader is not called. This does work in PHP 5.6.11.\r\n\r\nExample code:\r\n\r\n````php\r\n<?php\r\nclass Autoloader1\r\n{\r\n\tpublic static function autoload ($class)\r\n\t{\r\n\t\tvar_dump(\"Loading {$class} from \" . __CLASS__);\r\n\r\n\t\tspl_autoload_register([\"Autoloader2\", \"autoload\"]);\r\n\t}\r\n}\r\nclass Autoloader2\r\n{\r\n\tpublic static function autoload ($class)\r\n\t{\r\n\t\tvar_dump(\"Loading {$class} from \" . __CLASS__);exit;\r\n\t}\r\n}\r\n\r\nspl_autoload_register([\"Autoloader1\", \"autoload\"]);\r\n\r\n$r = new Foo();\r\n````\r\n\r\nOutput from PHP 5.6.11:\r\n\r\n````\r\nstring(28) \"Loading Foo from Autoloader1\"\r\nstring(28) \"Loading Foo from Autoloader2\"\r\n\r\nFatal error: Class undefined: Foo in /var/www/willem/tests/hhvmautoload.php on line 26\r\n````\r\n\r\nOutput from HHVM 3.8.0\r\n\r\n````\r\nstring(28) \"Loading Foo from Autoloader1\"\r\n\r\nFatal error: Class undefined: Foo in /var/www/willem/tests/hhvmautoload.php on line 26\r\n````\r\n\r\nNote how the second autoloader is not called in the HHVM example. "}}