xref: /PHP-7.3/Zend/tests/bug78868.phpt (revision bb30fe9e)
1--TEST--
2Bug #78868: Calling __autoload() with incorrect EG(fake_scope) value
3--FILE--
4<?php
5class C {
6	private $private = 1;
7
8	function foo() {
9		$this->private++; //fails with EG(fake_scope) != NULL && EG(fake_scope) != "C"
10	}
11}
12
13class A {
14	static $foo = B::foo; //not resolved on include()
15}
16
17function main_autoload($class_name) {
18	$c = new C;
19	$c->foo();
20	//doesn't affect the error
21	eval("class B {const foo = 1;}");
22}
23
24spl_autoload_register('main_autoload', false);
25
26$classA = new ReflectionClass("A");
27$props = $classA->getProperties();
28$props[0]->setValue(2); //causes constant resolving, which runs autoload, all with EG(fake_scope) == "A"
29
30echo "OK\n";
31?>
32--EXPECT--
33OK
34