bug37667.phpt 911 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. --TEST--
  2. Bug #37667 (Object is not added into array returned by __get)
  3. --FILE--
  4. <?php
  5. class Test
  6. {
  7. protected $property = array('foo' => 'bar');
  8. function __get($name)
  9. {
  10. return $this->property;
  11. }
  12. }
  13. $obj = new Test;
  14. var_dump($obj->property['foo']);
  15. var_dump($obj->property[2]);
  16. var_dump($obj);
  17. $obj->property[] = 1;
  18. $obj->property[] = 2;
  19. var_dump($obj);
  20. ?>
  21. ===DONE===
  22. --EXPECTF--
  23. string(3) "bar"
  24. Notice: Undefined offset: 2 in %sbug37667.php on line 16
  25. NULL
  26. object(Test)#%d (1) {
  27. ["property":protected]=>
  28. array(1) {
  29. ["foo"]=>
  30. string(3) "bar"
  31. }
  32. }
  33. Notice: Indirect modification of overloaded property Test::$property has no effect in %sbug37667.php on line 20
  34. Notice: Indirect modification of overloaded property Test::$property has no effect in %sbug37667.php on line 21
  35. object(Test)#%d (1) {
  36. ["property":protected]=>
  37. array(1) {
  38. ["foo"]=>
  39. string(3) "bar"
  40. }
  41. }
  42. ===DONE===