From 61501749410e2ba23358fe655faea1c7c607c5c3 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sun, 1 Aug 2010 17:34:09 +0000 Subject: [PATCH] - Fixed bug #52468 (wddx_deserialize corrupts integer field value when left empty) --- NEWS | 2 ++ ext/wddx/tests/bug52468.phpt | 20 ++++++++++++++++++++ ext/wddx/wddx.c | 1 + 3 files changed, 23 insertions(+) create mode 100644 ext/wddx/tests/bug52468.phpt diff --git a/NEWS b/NEWS index 8e6193f45a..c14c38282d 100644 --- 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 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-- +
my_command
"; + +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; -- 2.40.0