bug70262.phpt 710 B

123456789101112131415161718192021222324252627282930
  1. --TEST--
  2. Bug #70262 (Accessing array crashes)
  3. --FILE--
  4. <?php
  5. $array = array();
  6. $array[] = 1; // make this not immutable
  7. $extra = $array; // make the refcount == 2
  8. class A {
  9. public function getObj($array) {
  10. $obj = new Stdclass;
  11. $obj->arr = $array; // make the refcount == 3;
  12. return $obj;
  13. }
  14. }
  15. $a = new A;
  16. $a->getObj($array) //use function call to get a refcount == 1 IS_VAR object
  17. ->arr // FETCH_OBJ_W will EXTRACT_ZVAL_PTR because getObj() result a refcount == 1 object (READY_TO_DESTROY)
  18. [0] = "test"; //We will get a refcount == 3 array (not a IS_INDIRCT) in ZEND_ASSIGN_DIM_SPEC_VAR_CONST_HANDLER
  19. var_dump($array);
  20. ?>
  21. --EXPECT--
  22. array(1) {
  23. [0]=>
  24. int(1)
  25. }