iliaa           Sun May 27 16:31:36 2007 UTC

  Added files:                 (Branch: PHP_5_2)
    /php-src/ext/json/tests     bug41504.phpt 

  Modified files:              
    /php-src    NEWS 
    /php-src/ext/json   JSON_parser.c 
  Log:
  
  Fixed bug #41504 (json_decode() incorrectly decodes JSON arrays with empty
  string keys).
  
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.737&r2=1.2027.2.547.2.738&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.737 php-src/NEWS:1.2027.2.547.2.738
--- php-src/NEWS:1.2027.2.547.2.737     Sun May 27 15:11:31 2007
+++ php-src/NEWS        Sun May 27 16:31:35 2007
@@ -2,6 +2,8 @@
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? Jun 2007, PHP 5.2.3
 - Fixed bug #41511 (Compile failure under IRIX 6.5.30 building md5.c). (Jani)
+- Fixed bug #41504 (json_decode() incorrectly decodes JSON arrays with empty
+  string keys). (Ilia)
 
 24 May 2007, PHP 5.2.3RC1
 - Changed CGI install target to php-cgi and 'make install' to install CLI
http://cvs.php.net/viewvc.cgi/php-src/ext/json/JSON_parser.c?r1=1.1.2.9&r2=1.1.2.10&diff_format=u
Index: php-src/ext/json/JSON_parser.c
diff -u php-src/ext/json/JSON_parser.c:1.1.2.9 
php-src/ext/json/JSON_parser.c:1.1.2.10
--- php-src/ext/json/JSON_parser.c:1.1.2.9      Thu May 24 22:40:02 2007
+++ php-src/ext/json/JSON_parser.c      Sun May 27 16:31:35 2007
@@ -364,7 +364,7 @@
         }
         else
         {
-            add_assoc_zval_ex(root, (key->len ? key->c : "_empty_"), (key->len 
? (key->len + 1) : sizeof("_empty_")), child);
+            add_assoc_zval_ex(root, (key->len ? key->c : ""), (key->len ? 
(key->len + 1) : sizeof("")), child);
         }
         key->len = 0;
     }
@@ -507,7 +507,7 @@
                     }
                     else
                     {
-                        add_assoc_zval_ex(JSON(the_zstack)[JSON(the_top)], 
(key.len ? key.c : "_empty_"), (key.len ? (key.len + 1) : sizeof("_empty_")), 
mval);
+                        add_assoc_zval_ex(JSON(the_zstack)[JSON(the_top)], 
(key.len ? key.c : ""), (key.len ? (key.len + 1) : sizeof("")), mval);
                     }
                     key.len = 0;
                     buf.len = 0;
@@ -638,7 +638,7 @@
                                 }
                                 else
                                 {
-                                    
add_assoc_zval_ex(JSON(the_zstack)[JSON(the_top)], (key.len ? key.c : 
"_empty_"), (key.len ? (key.len + 1) : sizeof("_empty_")), mval);
+                                    
add_assoc_zval_ex(JSON(the_zstack)[JSON(the_top)], (key.len ? key.c : ""), 
(key.len ? (key.len + 1) : sizeof("")), mval);
                                 }
                                 key.len = 0;
                             }

http://cvs.php.net/viewvc.cgi/php-src/ext/json/tests/bug41504.phpt?view=markup&rev=1.1
Index: php-src/ext/json/tests/bug41504.phpt
+++ php-src/ext/json/tests/bug41504.phpt

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to