Bug #72564 [Asn->Csd]: boolean always deserialized as "true"
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: Assigned
+Status: Closed
Type: Bug
Package: WDDX related
Operating System: irrevelant
PHP Version: 7.0.8
Assigned To: remi
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of remi
Revision: http://git.php.net/?p=php-src.git;a=commit;h=99d6e09c3d6679bb522836c833d0cfd4f79c6014
Log: Fixed Bug #72564 boolean always deserialized as "true"
Previous Comments:
------------------------------------------------------------------------
[2016-07-08 06:56:55] remi@php.net
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) {
------------------------------------------------------------------------
[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
Thread (3 messages)