php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #72564 boolean always deserialized as "true"
Submitted: 2016-07-08 06:55 UTC Modified: 2016-07-08 06:56 UTC
From: remi@php.net Assigned: remi (profile)
Status: Closed Package: WDDX related
PHP Version: 7.0.8 OS: irrevelant
Private report: No CVE-ID: None
 [2016-07-08 06:55 UTC] 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


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-07-08 06:56 UTC] remi@php.net
-Assigned To: +Assigned To: remi
 [2016-07-08 06:56 UTC] 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 08:48 UTC] remi@php.net
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"
 [2016-07-08 08:48 UTC] remi@php.net
-Status: Assigned +Status: Closed
 [2016-07-20 11:30 UTC] davey@php.net
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"
 [2016-10-17 10:11 UTC] bwoebi@php.net
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"
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 09:01:32 2024 UTC