Bug #72564 [Opn]: boolean always deserialized as "true"
| From: | remi@php.net | Date: | Fri, 08 Jul 2016 06:56:57 +0000 |
| Subject: | Bug #72564 [Opn]: boolean always deserialized as "true" | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-202126@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72564&edit=1
ID: 72564
Updated by: remi@php.net
Reported by: remi@php.net
Summary: boolean always deserialized as "true"
Status: Open
Type: Bug
Package: WDDX related
Operating System: irrevelant
PHP Version: 7.0.8
-Assigned To:
+Assigned To: remi
Block user comment: N
Private report: N
New Comment:
I will commit patch + test later today:
diff --git a/ext/wddx/wddx.c b/ext/wddx/wddx.c
index 13e48ff..c1121a7 100644
--- a/ext/wddx/wddx.c
+++ b/ext/wddx/wddx.c
@@ -1009,9 +1009,9 @@ static void php_wddx_process_data(void *user_data, const XML_Char *s, int len)
case ST_BOOLEAN:
if (!strcmp((char *)s, "true")) {
- Z_LVAL(ent->data) = 1;
+ ZVAL_TRUE(&ent->data);
} else if (!strcmp((char *)s, "false")) {
- Z_LVAL(ent->data) = 0;
+ ZVAL_FALSE(&ent->data);
} else {
zval_ptr_dtor(&ent->data);
if (ent->varname) {
Previous Comments:
------------------------------------------------------------------------
[2016-07-08 06:55:59] remi@php.net
Description:
------------
boolean always deserialized as "true"
PHP 5 is ok
Detected as zend-zerializer test suite is failing.
Test script:
---------------
foreach([true, false, NULL] as $v) {
$x = wddx_serialize_value($v);
var_dump(wddx_deserialize($x));
}
Expected result:
----------------
bool(true)
bool(false)
NULL
Actual result:
--------------
bool(true)
bool(true)
NULL
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72564&edit=1