bug75231.phpt 485 B

12345678910111213141516171819202122232425
  1. --TEST--
  2. Bug #75231: ReflectionProperty#getValue() incorrectly works with inherited classes
  3. --FILE--
  4. <?php
  5. class A
  6. {
  7. public $prop;
  8. public function __construct()
  9. {
  10. $this->prop = 'prop';
  11. }
  12. public function method()
  13. {
  14. return 'method';
  15. }
  16. }
  17. class B extends A
  18. {
  19. }
  20. print_r((new ReflectionMethod(B::class, 'method'))->invoke(new A()).PHP_EOL);
  21. print_r((new ReflectionProperty(B::class, 'prop'))->getValue(new A()).PHP_EOL);
  22. ?>
  23. --EXPECT--
  24. method
  25. prop