summaryrefslogtreecommitdiff
path: root/ext/json/JSON_parser.c
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2006-07-20 08:24:31 +0000
committerAntony Dovgal <tony2001@php.net>2006-07-20 08:24:31 +0000
commit0b97d2bd6072fc8939f452459f0b4ae46582a06a (patch)
tree6a22f133924a19a15891973bfcdc46885933362a /ext/json/JSON_parser.c
parent074feedc2b6f2414603fa59b1584b3b95682e3f2 (diff)
downloadphp-git-0b97d2bd6072fc8939f452459f0b4ae46582a06a.tar.gz
fix segfault, add test
Diffstat (limited to 'ext/json/JSON_parser.c')
-rw-r--r--ext/json/JSON_parser.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/ext/json/JSON_parser.c b/ext/json/JSON_parser.c
index adb974346e..f4ee177548 100644
--- a/ext/json/JSON_parser.c
+++ b/ext/json/JSON_parser.c
@@ -338,14 +338,14 @@ static void attach_zval(json_parser *json, int up, int cur, smart_str *key, int
{
if (!assoc)
{
- add_property_zval(root, key->c, child);
+ add_property_zval_ex(root, (key->len ? key->c : "_empty_"), (key->len ? (key->len + 1) : sizeof("_empty_")), child);
#if PHP_MAJOR_VERSION >= 5
ZVAL_DELREF(child);
#endif
}
else
{
- add_assoc_zval(root, key->c, child);
+ add_assoc_zval_ex(root, (key->len ? key->c : "_empty_"), (key->len ? (key->len + 1) : sizeof("_empty_")), child);
}
key->len = 0;
}
@@ -481,14 +481,14 @@ JSON_parser(zval *z, unsigned short p[], int length, int assoc TSRMLS_DC)
if (!assoc)
{
- add_property_zval(JSON(the_zstack)[JSON(the_top)], key.c, mval);
+ add_property_zval_ex(JSON(the_zstack)[JSON(the_top)], (key.len ? key.c : "_empty_"), (key.len ? (key.len + 1) : sizeof("_empty_")), mval);
#if PHP_MAJOR_VERSION >= 5
ZVAL_DELREF(mval);
#endif
}
else
{
- add_assoc_zval(JSON(the_zstack)[JSON(the_top)], key.c, mval);
+ add_assoc_zval_ex(JSON(the_zstack)[JSON(the_top)], (key.len ? key.c : "_empty_"), (key.len ? (key.len + 1) : sizeof("_empty_")), mval);
}
key.len = 0;
buf.len = 0;
@@ -604,14 +604,14 @@ JSON_parser(zval *z, unsigned short p[], int length, int assoc TSRMLS_DC)
{
if (!assoc)
{
- add_property_zval(JSON(the_zstack)[JSON(the_top)], (key.len ? key.c : "_empty_"), mval);
+ add_property_zval_ex(JSON(the_zstack)[JSON(the_top)], (key.len ? key.c : "_empty_"), (key.len ? (key.len + 1) : sizeof("_empty_")), mval);
#if PHP_MAJOR_VERSION >= 5
ZVAL_DELREF(mval);
#endif
}
else
{
- add_assoc_zval(JSON(the_zstack)[JSON(the_top)], (key.len ? key.c : "_empty_"), mval);
+ add_assoc_zval_ex(JSON(the_zstack)[JSON(the_top)], (key.len ? key.c : "_empty_"), (key.len ? (key.len + 1) : sizeof("_empty_")), mval);
}
key.len = 0;
}