From d7b37fa96bf63eb3b8cfaca7e49259dab340be86 Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Thu, 24 Jul 2003 20:28:15 +0000 Subject: [PATCH] Update due to Zeev's latest engine changes --- ext/spl/spl_array.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index f4cdf2d156..f7413f5b89 100755 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -378,23 +378,19 @@ zval *spl_array_read_dimension(zval *object, zval *offset TSRMLS_DC) switch(Z_TYPE_P(offset)) { case IS_STRING: - if (!zend_is_numeric_key(offset, &index)) { - if (zend_hash_find(HASH_OF(intern->array), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **) &retval) == FAILURE) { - zend_error(E_NOTICE,"Undefined index: %s", Z_STRVAL_P(offset)); - return EG(uninitialized_zval_ptr); - } else { - return *retval; - } - break; + if (zend_symtable_find(HASH_OF(intern->array), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **) &retval) == FAILURE) { + zend_error(E_NOTICE,"Undefined index: %s", Z_STRVAL_P(offset)); + return EG(uninitialized_zval_ptr); + } else { + return *retval; } - /* NO break */ case IS_DOUBLE: case IS_RESOURCE: case IS_BOOL: case IS_LONG: if (offset->type == IS_DOUBLE) { index = (long)Z_DVAL_P(offset); - } else if (offset->type != IS_STRING) { + } else { index = Z_LVAL_P(offset); } if (zend_hash_index_find(HASH_OF(intern->array), index, (void **) &retval) == FAILURE) { @@ -419,18 +415,15 @@ void spl_array_write_dimension(zval *object, zval *offset, zval *value TSRMLS_DC switch(Z_TYPE_P(offset)) { case IS_STRING: - if (!zend_is_numeric_key(offset, &index)) { - add_assoc_zval(intern->array, Z_STRVAL_P(offset), value); - return; - } - /* NO break */ + zend_symtable_update(HASH_OF(intern->array), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void**)&value, sizeof(void*), NULL); + return; case IS_DOUBLE: case IS_RESOURCE: case IS_BOOL: case IS_LONG: if (offset->type == IS_DOUBLE) { index = (long)Z_DVAL_P(offset); - } else if (offset->type != IS_STRING) { + } else { index = Z_LVAL_P(offset); } add_index_zval(intern->array, index, value); -- 2.50.1