bug78921.phpt 937 B

123456789101112131415161718192021222324252627282930313233343536
  1. --TEST--
  2. Bug #78921: When Reflection triggers class load, property visibility is incorrect
  3. --FILE--
  4. <?php
  5. spl_autoload_register(function($className) {
  6. if ($className == 'PrivateStatic') {
  7. class PrivateStatic
  8. {
  9. const SOME_CONST = 13;
  10. private static $privateStaticVarArray = ['a', 'b', 'c'];
  11. private static $otherStatic;
  12. public static function init()
  13. {
  14. self::$otherStatic = self::$privateStaticVarArray;
  15. }
  16. }
  17. PrivateStatic::init();
  18. }
  19. });
  20. class OtherClass
  21. {
  22. const MY_CONST = PrivateStatic::SOME_CONST;
  23. public static $prop = 'my property';
  24. }
  25. $reflectionClass = new ReflectionClass('OtherClass');
  26. $reflectionProperty = $reflectionClass->getProperty('prop');
  27. $reflectionProperty->setAccessible(true);
  28. $value = $reflectionProperty->getValue();
  29. echo "Value is $value\n";
  30. ?>
  31. --EXPECT--
  32. Value is my property