bug78921.phpt 895 B

1234567891011121314151617181920212223242526272829303132333435
  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. $value = $reflectionProperty->getValue();
  28. echo "Value is $value\n";
  29. ?>
  30. --EXPECT--
  31. Value is my property