From 83d26fc47d6a551ea696b74d2c299548272486d6 Mon Sep 17 00:00:00 2001 From: Antony Dovgal Date: Sat, 7 Jun 2008 12:47:04 +0000 Subject: [PATCH] MFH: disallow $a[] = value syntax --- ext/spl/spl_fastarray.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ext/spl/spl_fastarray.c b/ext/spl/spl_fastarray.c index ae1129c1eca..6449f0ddc27 100644 --- a/ext/spl/spl_fastarray.c +++ b/ext/spl/spl_fastarray.c @@ -321,6 +321,12 @@ static inline void spl_fastarray_object_write_dimension_helper(spl_fastarray_obj { long index; + if (!offset) { + /* '$array[] = value' syntax is not supported */ + zend_throw_exception(spl_ce_RuntimeException, "Index invalid or out of range", 0 TSRMLS_CC); + return; + } + index = spl_offset_convert_to_long(offset TSRMLS_CC); if (index < 0 || index >= intern->array->size) {