bug68896.phpt 682 B

12345678910111213141516171819202122232425262728293031
  1. --TEST--
  2. Bug #68896 (Changing ArrayObject value cause Segment Fault)
  3. --FILE--
  4. <?php
  5. class A implements ArrayAccess {
  6. private $a = [];
  7. function offsetGet($offset) {
  8. return $this->a[$offset];
  9. }
  10. function offsetSet($offset, $value) {
  11. $this->a[$offset] = $value;
  12. }
  13. function offsetExists($offset) {
  14. isset($this->a[$offset]);
  15. }
  16. function offsetUnset($offset) {
  17. unset($this->a[$offset]);
  18. }
  19. }
  20. $obj = new ArrayObject(["a" => 1]);
  21. $obj["a"] .= "test";
  22. var_dump($obj["a"]);
  23. $obj = new A;
  24. $obj["a"] = 1;
  25. $obj["a"] .= "test";
  26. var_dump($obj["a"]);
  27. --EXPECT--
  28. string(5) "1test"
  29. string(5) "1test"