Bug #78868 [Opn->Csd]: Calling __autoload() with incorrect EG(fake_scope) value

From: Date: Mon, 25 Nov 2019 11:11:00 +0000
Subject: Bug #78868 [Opn->Csd]: Calling __autoload() with incorrect EG(fake_scope) value
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-223878@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78868&edit=1 ID: 78868 Updated by: dmitry@php.net Reported by: dmitry@php.net Summary: Calling __autoload() with incorrect EG(fake_scope) value -Status: Open +Status: Closed Type: Bug Package: Scripting Engine problem Operating System: * PHP Version: 7.3Git-2019-11-25 (Git) Block user comment: N Private report: N New Comment: Automatic comment on behalf of dmitry@zend.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=bb30fe9e2b86a46a167c88daaae0c650cb01afa2 Log: Fixed bug #78868 (Calling __autoload() with incorrect EG(fake_scope) value) Previous Comments: ------------------------------------------------------------------------ [2019-11-25 10:22:37] dmitry@php.net Description: ------------ __autoload() may be called with wrong EG(fake_scope) value Test script: --------------- <?php class C { private $private = 1; function foo() { $this->private++; //fails with EG(fake_scope) != NULL && EG(fake_scope) != "C" } } class A { static $foo = B::foo; //not resolved on include() } function main_autoload($class_name) { $c = new C; $c->foo(); //doesn't affect the error eval("class B {const foo = 1;}"); } spl_autoload_register('main_autoload', false); $classA = new ReflectionClass("A"); $props = $classA->getProperties(); $props[0]->setValue(2); //causes constant resolving, which runs autoload, all with EG(fake_scope) == "A" echo "OK\n"; Expected result: ---------------- OK Actual result: -------------- PHP Fatal error: Uncaught Error: Cannot access private property C::$private in bug.php ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78868&edit=1

« previous php.bugs (#223878) next »