bug41692.phpt 867 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. --TEST--
  2. Bug #41692 (ArrayObject shows weird behaviour in respect to inheritance)
  3. --FILE--
  4. <?php
  5. class Bar extends ArrayObject {
  6. private $foo = array( 1, 2, 3 );
  7. function __construct()
  8. {
  9. parent::__construct($this->foo);
  10. }
  11. }
  12. $foo = new Bar();
  13. var_dump($foo);
  14. $foo['foo'] = 23;
  15. $bar = new Bar();
  16. var_dump($bar);
  17. echo "Done\n";
  18. ?>
  19. --EXPECTF--
  20. object(Bar)#%d (2) {
  21. ["foo":"Bar":private]=>
  22. array(3) {
  23. [0]=>
  24. int(1)
  25. [1]=>
  26. int(2)
  27. [2]=>
  28. int(3)
  29. }
  30. ["storage":"ArrayObject":private]=>
  31. array(3) {
  32. [0]=>
  33. int(1)
  34. [1]=>
  35. int(2)
  36. [2]=>
  37. int(3)
  38. }
  39. }
  40. object(Bar)#%d (2) {
  41. ["foo":"Bar":private]=>
  42. array(3) {
  43. [0]=>
  44. int(1)
  45. [1]=>
  46. int(2)
  47. [2]=>
  48. int(3)
  49. }
  50. ["storage":"ArrayObject":private]=>
  51. array(3) {
  52. [0]=>
  53. int(1)
  54. [1]=>
  55. int(2)
  56. [2]=>
  57. int(3)
  58. }
  59. }
  60. Done