summaryrefslogtreecommitdiff
path: root/ext/wddx
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2010-08-01 17:34:09 +0000
committerFelipe Pena <felipe@php.net>2010-08-01 17:34:09 +0000
commit88b087bedd4c15a12306324aad8384c118434129 (patch)
treedef16b0de7b9119a48e070b055c128b0bb5fa154 /ext/wddx
parenta20d96e850a9ce6f2c1c190594fdaec55069ba3c (diff)
downloadphp-git-88b087bedd4c15a12306324aad8384c118434129.tar.gz
- Fixed bug #52468 (wddx_deserialize corrupts integer field value when left empty)
Diffstat (limited to 'ext/wddx')
-rw-r--r--ext/wddx/tests/bug52468.phpt20
-rw-r--r--ext/wddx/wddx.c1
2 files changed, 21 insertions, 0 deletions
diff --git a/ext/wddx/tests/bug52468.phpt b/ext/wddx/tests/bug52468.phpt
new file mode 100644
index 0000000000..151c236396
--- /dev/null
+++ b/ext/wddx/tests/bug52468.phpt
@@ -0,0 +1,20 @@
+--TEST--
+Bug #52468 (wddx_deserialize corrupts integer field value when left empty)
+--FILE--
+<?php
+
+$message = "<wddxPacket version='1.0'><header><comment>my_command</comment></header><data><struct><var name='handle'><number></number></var></struct></data></wddxPacket>";
+
+print_r(wddx_deserialize($message));
+print_r(wddx_deserialize($message));
+
+?>
+--EXPECT--
+Array
+(
+ [handle] => 0
+)
+Array
+(
+ [handle] => 0
+)
diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c
index 4c61cd6cb7..9119e18d8d 100644
--- a/ext/wddx/wddx.c
+++ b/ext/wddx/wddx.c
@@ -785,6 +785,7 @@ static void php_wddx_push_element(void *user_data, const XML_Char *name, const X
ALLOC_ZVAL(ent.data);
INIT_PZVAL(ent.data);
Z_TYPE_P(ent.data) = IS_LONG;
+ Z_LVAL_P(ent.data) = 0;
wddx_stack_push((wddx_stack *)stack, &ent, sizeof(st_entry));
} else if (!strcmp(name, EL_BOOLEAN)) {
int i;