]> granicus.if.org Git - php/commitdiff
oops, empty properties are not allowed
authorAntony Dovgal <tony2001@php.net>
Fri, 8 Jun 2007 08:57:21 +0000 (08:57 +0000)
committerAntony Dovgal <tony2001@php.net>
Fri, 8 Jun 2007 08:57:21 +0000 (08:57 +0000)
ext/json/JSON_parser.c

index 36298fbbc51ea81d8d000cd9fc9b2a8afaddddcc..3e091864f9c57be5792c03de7303891d5ece93ea 100644 (file)
@@ -357,7 +357,7 @@ static void attach_zval(json_parser *json, int up, int cur, smart_str *key, int
     {
         if (!assoc)
         {
-            add_utf8_property_zval_ex(root, (key->len ? key->c : ""), (key->len ? (key->len + 1) : sizeof("")), child TSRMLS_CC);
+            add_utf8_property_zval_ex(root, (key->len ? key->c : "_empty_"), (key->len ? (key->len + 1) : sizeof("_empty_")), child TSRMLS_CC);
 #if PHP_MAJOR_VERSION >= 5
             ZVAL_DELREF(child);
 #endif
@@ -500,7 +500,7 @@ JSON_parser(zval *z, unsigned short p[], int length, int assoc TSRMLS_DC)
 
                     if (!assoc)
                     {
-                        add_utf8_property_zval_ex(JSON(the_zstack)[JSON(the_top)], (key.len ? key.c : ""), (key.len ? (key.len + 1) : sizeof("")), mval TSRMLS_CC);
+                        add_utf8_property_zval_ex(JSON(the_zstack)[JSON(the_top)], (key.len ? key.c : "_empty_"), (key.len ? (key.len + 1) : sizeof("_empty_")), mval TSRMLS_CC);
 #if PHP_MAJOR_VERSION >= 5
                         ZVAL_DELREF(mval);
 #endif
@@ -631,7 +631,7 @@ JSON_parser(zval *z, unsigned short p[], int length, int assoc TSRMLS_DC)
                             {
                                 if (!assoc)
                                 {
-                                    add_utf8_property_zval_ex(JSON(the_zstack)[JSON(the_top)], (key.len ? key.c : ""), (key.len ? (key.len + 1) : sizeof("")), mval TSRMLS_CC);
+                                    add_utf8_property_zval_ex(JSON(the_zstack)[JSON(the_top)], (key.len ? key.c : "_empty_"), (key.len ? (key.len + 1) : sizeof("_empty_")), mval TSRMLS_CC);
 #if PHP_MAJOR_VERSION >= 5
                                     ZVAL_DELREF(mval);
 #endif