bug78868.phpt 703 B

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