diff options
| author | Ilia Alshanetsky <iliaa@php.net> | 2007-01-07 03:52:44 +0000 |
|---|---|---|
| committer | Ilia Alshanetsky <iliaa@php.net> | 2007-01-07 03:52:44 +0000 |
| commit | 5068511748861c9dbeb603ec704f07bf81959901 (patch) | |
| tree | 1dc44dadaa6a7635f7e2eeb4335e50888402b4b7 /ext/spl/spl_array.c | |
| parent | cbf6f5b53839dd72170b8e766fdc7fa0fca5dabe (diff) | |
| download | php-git-5068511748861c9dbeb603ec704f07bf81959901.tar.gz | |
Fixed bug #40036 (empty() does not work correctly with ArrayObject when
using ARRAY_AS_PROPS).
Diffstat (limited to 'ext/spl/spl_array.c')
| -rwxr-xr-x | ext/spl/spl_array.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c index a4665d8e46..5ba4689490 100755 --- a/ext/spl/spl_array.c +++ b/ext/spl/spl_array.c @@ -476,7 +476,16 @@ static int spl_array_has_dimension_ex(int check_inherited, zval *object, zval *o switch(Z_TYPE_P(offset)) { case IS_STRING: - return zend_symtable_exists(spl_array_get_hash_table(intern, 0 TSRMLS_CC), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + if (check_empty) { + zval **tmp; + HashTable *ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); + if (zend_hash_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **) &tmp) != FAILURE && zend_is_true(*tmp)) { + return 1; + } + return 0; + } else { + return zend_symtable_exists(spl_array_get_hash_table(intern, 0 TSRMLS_CC), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1); + } case IS_DOUBLE: case IS_RESOURCE: case IS_BOOL: @@ -486,7 +495,16 @@ static int spl_array_has_dimension_ex(int check_inherited, zval *object, zval *o } else { index = Z_LVAL_P(offset); } - return zend_hash_index_exists(spl_array_get_hash_table(intern, 0 TSRMLS_CC), index); + if (check_empty) { + zval **tmp; + HashTable *ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); + if (zend_hash_index_find(ht, index, (void **)&tmp) != FAILURE && zend_is_true(*tmp)) { + return 1; + } + return 0; + } else { + return zend_hash_index_exists(spl_array_get_hash_table(intern, 0 TSRMLS_CC), index); + } default: zend_error(E_WARNING, "Illegal offset type"); } |
