bug46064_2.phpt 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. --TEST--
  2. Bug #46064.2 (Exception when creating ReflectionProperty object on dynamicly created property)
  3. --FILE--
  4. <?php
  5. class foo {
  6. }
  7. $x = new foo;
  8. $x->test = 2000;
  9. $p = new ReflectionObject($x);
  10. var_dump($p->getProperty('test'));
  11. class bar {
  12. public function __construct() {
  13. $this->a = 1;
  14. }
  15. }
  16. class test extends bar {
  17. private $b = 2;
  18. public function __construct() {
  19. parent::__construct();
  20. $p = new reflectionobject($this);
  21. var_dump($h = $p->getProperty('a'));
  22. var_dump($h->isDefault(), $h->isProtected(), $h->isPrivate(), $h->isPublic(), $h->isStatic());
  23. var_dump($p->getProperties());
  24. }
  25. }
  26. new test;
  27. ?>
  28. --EXPECTF--
  29. object(ReflectionProperty)#%d (2) {
  30. ["name"]=>
  31. string(4) "test"
  32. ["class"]=>
  33. string(3) "foo"
  34. }
  35. object(ReflectionProperty)#%d (2) {
  36. ["name"]=>
  37. string(1) "a"
  38. ["class"]=>
  39. string(4) "test"
  40. }
  41. bool(false)
  42. bool(false)
  43. bool(false)
  44. bool(true)
  45. bool(false)
  46. array(2) {
  47. [0]=>
  48. object(ReflectionProperty)#%d (2) {
  49. ["name"]=>
  50. string(1) "b"
  51. ["class"]=>
  52. string(4) "test"
  53. }
  54. [1]=>
  55. object(ReflectionProperty)#%d (2) {
  56. ["name"]=>
  57. string(1) "a"
  58. ["class"]=>
  59. string(4) "test"
  60. }
  61. }