ZVAL_DEREF(offset);
goto try_again;
default:
- zend_error(E_WARNING, "Illegal offset type");
+ zend_type_error("Illegal offset type");
return (type == BP_VAR_W || type == BP_VAR_RW) ?
&EG(error_zval) : &EG(uninitialized_zval);
}
ZVAL_DEREF(offset);
goto try_again;
default:
- zend_error(E_WARNING, "Illegal offset type");
+ zend_type_error("Illegal offset type");
zval_ptr_dtor(value);
return;
}
ZVAL_DEREF(offset);
goto try_again;
default:
- zend_error(E_WARNING, "Illegal offset type");
+ zend_type_error("Illegal offset type in unset");
return;
}
} /* }}} */
ZVAL_DEREF(offset);
goto try_again;
default:
- zend_error(E_WARNING, "Illegal offset type");
+ zend_type_error("Illegal offset type in isset or empty");
return 0;
}
--- /dev/null
+--TEST--
+ArrayObject illegal offset
+--FILE--
+<?php
+
+$ao = new ArrayObject([1, 2, 3]);
+try {
+ var_dump($ao[[]]);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $ao[[]] = new stdClass;
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ $ref =& $ao[[]];
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ var_dump(isset($ao[[]]));
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+try {
+ unset($ao[[]]);
+} catch (TypeError $e) {
+ echo $e->getMessage(), "\n";
+}
+
+?>
+--EXPECT--
+Illegal offset type
+Illegal offset type
+Illegal offset type
+Illegal offset type in isset or empty
+Illegal offset type in unset
+++ /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