024.phpt 728 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. --TEST--
  2. ReflectionObject::__toString (filtering privates/protected dynamic properties)
  3. --SKIPIF--
  4. <?php extension_loaded('reflection') or die('skip'); ?>
  5. --FILE--
  6. <?php
  7. class C1 {
  8. private $p1 = 1;
  9. protected $p2 = 2;
  10. public $p3 = 3;
  11. }
  12. $x = new C1();
  13. $x->z = 4;
  14. $x->p3 = 5;
  15. $obj = new ReflectionObject($x);
  16. echo $obj;
  17. ?>
  18. --EXPECTF--
  19. Object of class [ <user> class C1 ] {
  20. @@ %s024.php 2-6
  21. - Constants [0] {
  22. }
  23. - Static properties [0] {
  24. }
  25. - Static methods [0] {
  26. }
  27. - Properties [3] {
  28. Property [ <default> private $p1 ]
  29. Property [ <default> protected $p2 ]
  30. Property [ <default> public $p3 ]
  31. }
  32. - Dynamic properties [1] {
  33. Property [ <dynamic> public $z ]
  34. }
  35. - Methods [0] {
  36. }
  37. }