return;
}
+ if (Z_REFCOUNTED_P(value)) {
+ Z_ADDREF_P(value);
+ }
+
if (!offset) {
ht = spl_array_get_hash_table(intern);
- if (Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
- }
zend_hash_next_index_insert(ht, value);
return;
}
- if (Z_REFCOUNTED_P(value)) {
- Z_ADDREF_P(value);
- }
-
try_again:
switch (Z_TYPE_P(offset)) {
case IS_STRING:
goto try_again;
default:
zend_error(E_WARNING, "Illegal offset type");
+ zval_ptr_dtor(value);
return;
}
} /* }}} */
--- /dev/null
+--TEST--
+Assignments to illegal ArrayObject offsets shouldn't leak
+--FILE--
+<?php
+
+$ao = new ArrayObject([1, 2, 3]);
+$ao[[]] = new stdClass;
+
+?>
+--EXPECTF--
+Warning: Illegal offset type in %s on line %d