iliaa Sun Jan 7 03:52:45 2007 UTC Added files: (Branch: PHP_5_2) /php-src/ext/spl/tests bug40036.phpt
Modified files: /php-src NEWS /php-src/ext/spl spl_array.c Log: Fixed bug #40036 (empty() does not work correctly with ArrayObject when using ARRAY_AS_PROPS). http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.475&r2=1.2027.2.547.2.476&diff_format=u Index: php-src/NEWS diff -u php-src/NEWS:1.2027.2.547.2.475 php-src/NEWS:1.2027.2.547.2.476 --- php-src/NEWS:1.2027.2.547.2.475 Sat Jan 6 16:50:55 2007 +++ php-src/NEWS Sun Jan 7 03:52:44 2007 @@ -3,6 +3,8 @@ ?? Jan 2007, PHP 5.2.1RC3 - Improved proc_open(). Now on Windows it can run external commands not through CMD.EXE. (Dmitry) +- Fixed bug #40036 (empty() does not work correctly with ArrayObject when using + ARRAY_AS_PROPS). (Ilia) - Fixed bug #39504 (xmlwriter_write_dtd_entity() creates Attlist tag, not entity). (Hannes) http://cvs.php.net/viewvc.cgi/php-src/ext/spl/spl_array.c?r1=1.71.2.17.2.6&r2=1.71.2.17.2.7&diff_format=u Index: php-src/ext/spl/spl_array.c diff -u php-src/ext/spl/spl_array.c:1.71.2.17.2.6 php-src/ext/spl/spl_array.c:1.71.2.17.2.7 --- php-src/ext/spl/spl_array.c:1.71.2.17.2.6 Mon Jan 1 09:36:07 2007 +++ php-src/ext/spl/spl_array.c Sun Jan 7 03:52:44 2007 @@ -16,7 +16,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: spl_array.c,v 1.71.2.17.2.6 2007/01/01 09:36:07 sebastian Exp $ */ +/* $Id: spl_array.c,v 1.71.2.17.2.7 2007/01/07 03:52:44 iliaa Exp $ */ #ifdef HAVE_CONFIG_H # include "config.h" @@ -476,7 +476,16 @@ 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 @@ } 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"); } http://cvs.php.net/viewvc.cgi/php-src/ext/spl/tests/bug40036.phpt?view=markup&rev=1.1 Index: php-src/ext/spl/tests/bug40036.phpt +++ php-src/ext/spl/tests/bug40036.phpt -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php