Bug #78868 [NEW]: Calling __autoload() with incorrect EG(fake_scope) value

From: Date: Mon, 25 Nov 2019 10:22:37 +0000
Subject: Bug #78868 [NEW]: Calling __autoload() with incorrect EG(fake_scope) value
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-223876@lists.php.net to get a copy of this message
From: dmitry Operating system: * PHP version: 7.3Git-2019-11-25 (Git) Package: Scripting Engine problem Bug Type: Bug Bug description:Calling __autoload() with incorrect EG(fake_scope) value 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 bug report at https://bugs.php.net/bug.php?id=78868&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=78868&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=78868&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=78868&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=78868&r=needscript Try newer version: https://bugs.php.net/fix.php?id=78868&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=78868&r=support Expected behavior: https://bugs.php.net/fix.php?id=78868&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=78868&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=78868&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=78868&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=78868&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=78868&r=dst IIS Stability: https://bugs.php.net/fix.php?id=78868&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=78868&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=78868&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=78868&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=78868&r=mysqlcfg

« previous php.bugs (#223876) next »