From 1f4f33afcfd8282bcdeff9ebcee7aade8c659308 Mon Sep 17 00:00:00 2001 From: Stanislav Malyshev Date: Mon, 19 Dec 2011 02:05:03 +0000 Subject: implement the solution for isset/string offsets, fix bug #60362 --- Zend/zend_execute.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'Zend/zend_execute.c') diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index e24a3dd6f2..3474ee43cd 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -1147,13 +1147,22 @@ convert_to_array: } if (Z_TYPE_P(dim) != IS_LONG) { + switch(Z_TYPE_P(dim)) { /* case IS_LONG: */ case IS_STRING: + if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) { + break; + } + if (type != BP_VAR_UNSET) { + zend_error(E_WARNING, "Illegal string offset '%s'", dim->value.str.val); + } + + break; case IS_DOUBLE: case IS_NULL: case IS_BOOL: - /* do nothing */ + zend_error(E_NOTICE, "String offset cast occured"); break; default: zend_error(E_WARNING, "Illegal offset type"); @@ -1265,10 +1274,19 @@ static void zend_fetch_dimension_address_read(temp_variable *result, zval **cont switch(Z_TYPE_P(dim)) { /* case IS_LONG: */ case IS_STRING: + if (IS_LONG == is_numeric_string(Z_STRVAL_P(dim), Z_STRLEN_P(dim), NULL, NULL, -1)) { + break; + } + if (type != BP_VAR_IS) { + zend_error(E_WARNING, "Illegal string offset '%s'", dim->value.str.val); + } + break; case IS_DOUBLE: case IS_NULL: case IS_BOOL: - /* do nothing */ + if (type != BP_VAR_IS) { + zend_error(E_NOTICE, "String offset cast occured"); + } break; default: zend_error(E_WARNING, "Illegal offset type"); -- cgit v1.2.1