]> granicus.if.org Git - php/commitdiff
- Fixed bug #52468 (wddx_deserialize corrupts integer field value when left empty)
authorFelipe Pena <felipe@php.net>
Sun, 1 Aug 2010 17:34:09 +0000 (17:34 +0000)
committerFelipe Pena <felipe@php.net>
Sun, 1 Aug 2010 17:34:09 +0000 (17:34 +0000)
NEWS
ext/wddx/tests/bug52468.phpt [new file with mode: 0644]
ext/wddx/wddx.c

diff --git a/NEWS b/NEWS
index 8e6193f45a93245136ca8e93c247b552f1727b79..c14c38282d1f68f842f7241860c9a8785462dfbc 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,8 @@ PHP                                                                        NEWS
 - Fixed bug #52487 (PDO::FETCH_INTO leaks memory). (Felipe)
 - Fixed bug #52484 (__set() ignores setting properties with empty names).
   (Felipe)
+- Fixed bug #52468 (wddx_deserialize corrupts integer field value when left
+  empty). (Felipe)
 - Fixed bug #52436 (Compile error if systems do not have stdint.h)
   (Sriram Natarajan)
 
diff --git a/ext/wddx/tests/bug52468.phpt b/ext/wddx/tests/bug52468.phpt
new file mode 100644 (file)
index 0000000..151c236
--- /dev/null
@@ -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
+)
index 4c61cd6cb7f1dec7f604577bd983ed32888259b1..9119e18d8d2a8e0e3b65b8f9cf8c888da8f29966 100644 (file)
@@ -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;