]> granicus.if.org Git - php/commitdiff
MFH: Fix #45820 (Empty ArrayObject keys not allowed)
authorEtienne Kneuss <colder@php.net>
Tue, 30 Dec 2008 23:34:29 +0000 (23:34 +0000)
committerEtienne Kneuss <colder@php.net>
Tue, 30 Dec 2008 23:34:29 +0000 (23:34 +0000)
NEWS
ext/spl/spl_array.c
ext/spl/tests/array_018.phpt

diff --git a/NEWS b/NEWS
index ead7b832568c48b82cca22dc8661687e569e8a21..96d6dade5c44d2da859ca1a5d62ff1ed36abf95b 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -33,6 +33,7 @@ PHP                                                                        NEWS
   (Scott)
 - Fixed bug #45989 (json_decode() doesn't return NULL on certain invalid
   strings). (magicaltux, Scott)
+- Fixed bug #45820 (Allow empty keys in ArrayObject). (Etienne)
 - Fixed bug #45791 (json_decode() doesn't convert 0e0 to a double). (Scott)
 
 04 Dec 2008, PHP 5.3.0 Alpha 3
index fb4d12a7de9543905056cfaa6f4bcf50af7ddd4e..dd423ab6830a09e221cba7701923412cd9623269 100755 (executable)
@@ -433,10 +433,6 @@ static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval
        }
        switch(Z_TYPE_P(offset)) {
        case IS_STRING:
-               if (*Z_STRVAL_P(offset) == '\0') {
-                       zend_throw_exception(spl_ce_InvalidArgumentException, "An offset must not begin with \\0 or be empty", 0 TSRMLS_CC);
-                       return;
-               }
                Z_ADDREF_P(value);
                zend_symtable_update(spl_array_get_hash_table(intern, 0 TSRMLS_CC), Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void**)&value, sizeof(void*), NULL);
                return;
index 996d276e04b2060688baf6d5d0f020da98afcfe8..7c68a6280e6bbc2c69f25bfde92ff88c12a8cdbb 100755 (executable)
Binary files a/ext/spl/tests/array_018.phpt and b/ext/spl/tests/array_018.phpt differ