forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* PHP-7.4: Fixed bug #78868 (Calling __autoload() with incorrect EG(fake_scope) value) Consolidate NEWS for 7.4.0 release WIP: Merge NEWS
- Loading branch information
Showing
2 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
--TEST-- | ||
Bug #78868: Calling __autoload() with incorrect EG(fake_scope) value | ||
--FILE-- | ||
<?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"; | ||
?> | ||
--EXPECT-- | ||
OK |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters