From: Sara Golemon Date: Wed, 23 Jun 2004 23:20:44 +0000 (+0000) Subject: BugFix #28879 Inconsistent behavior between explicit and implicit array creation. X-Git-Tag: php-5.0.0~135 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=56b153390b520c941f7e097bd5718c343e4bb10e;p=php BugFix #28879 Inconsistent behavior between explicit and implicit array creation. Changes: Throw E_WARNING "Illegal offset type" when explicitly creating array elements with objects, arrays, or resorces as indexes. This matches implicit creation w/ obj/arr indices. Throw E_WARNING "Resource ID#%ld used as offset, casting to integer (%ld)" when implicitly creating array with resource as index. (BC) --- diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c index 48d5eb7db1..733826352d 100644 --- a/Zend/zend_execute.c +++ b/Zend/zend_execute.c @@ -839,8 +839,10 @@ fetch_string_dim: } } break; - case IS_DOUBLE: case IS_RESOURCE: + zend_error(E_WARNING, "Resource ID#%ld used as offset, casting to integer (%ld)", dim->value.lval, dim->value.lval); + /* Fall Through */ + case IS_DOUBLE: case IS_BOOL: case IS_LONG: { long index; @@ -3402,6 +3404,7 @@ static inline int zend_init_add_array_helper(ZEND_OPCODE_HANDLER_ARGS) zend_hash_update(array_ptr->value.ht, "", sizeof(""), &expr_ptr, sizeof(zval *), NULL); break; default: + zend_error(E_WARNING, "Illegal offset type"); zval_ptr_dtor(&expr_ptr); /* do nothing */ break;