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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: remi@php.net
New email:
PHP Version: OS:

 

 [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: Sat Nov 23 07:01:29 2024 UTC