]> granicus.if.org Git - php/commitdiff
Fixed bug #70526 (xmlrpc_set_type returns false on success)
authorXinchen Hui <laruence@gmail.com>
Sat, 19 Sep 2015 13:10:48 +0000 (06:10 -0700)
committerXinchen Hui <laruence@gmail.com>
Sat, 19 Sep 2015 13:10:48 +0000 (06:10 -0700)
NEWS
ext/xmlrpc/tests/bug70526.phpt [new file with mode: 0644]
ext/xmlrpc/xmlrpc-epi-php.c

diff --git a/NEWS b/NEWS
index 57b7a73c11eac19e3a0b7e9bcc00bdba344c5b6d..ac0d0506efe9de9064dfd0e2c56dc4137a1a17bd 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -10,6 +10,8 @@ PHP                                                                        NEWS
   . Fixed bug #70529 (Session read causes "String is not zero-terminated" error).
     (Yasuo)
 
+- XMLRPC
+  . Fixed bug #70526 (xmlrpc_set_type returns false on success). (Laruence)
 
 17 Sep 2015, PHP 7.0.0 RC 3
 
diff --git a/ext/xmlrpc/tests/bug70526.phpt b/ext/xmlrpc/tests/bug70526.phpt
new file mode 100644 (file)
index 0000000..6ed3e1b
--- /dev/null
@@ -0,0 +1,14 @@
+--TEST--
+Bug #70526 (xmlrpc_set_type returns false on success)
+--SKIPIF--
+<?php
+if (!extension_loaded("xmlrpc")) print "skip";
+?>
+--FILE--
+<?php
+$params = date("Ymd\TH:i:s", time());
+$rv = xmlrpc_set_type($params, 'datetime');
+var_dump($rv);
+?>
+--EXPECT--     
+bool(true)
index 62bc39dba4d482ca222b993be080ae5816512ab7..7dcae1b2f7b1ac1c1e677d4cdbf86a85876ec583 100644 (file)
@@ -1283,7 +1283,7 @@ int set_zval_xmlrpc_type(zval* value, XMLRPC_VALUE_TYPE newtype) /* {{{ */
 
                                                convert_to_object(value);
                                                if (zend_hash_str_update(Z_OBJPROP_P(value), OBJECT_TYPE_ATTR, sizeof(OBJECT_TYPE_ATTR) - 1, &type)) {
-                                                       bSuccess = zend_hash_str_update(Z_OBJPROP_P(value), OBJECT_VALUE_TS_ATTR, sizeof(OBJECT_VALUE_TS_ATTR) - 1, &ztimestamp) != NULL;
+                                                       bSuccess = (zend_hash_str_update(Z_OBJPROP_P(value), OBJECT_VALUE_TS_ATTR, sizeof(OBJECT_VALUE_TS_ATTR) - 1, &ztimestamp) != NULL)? SUCCESS : FAILURE;
                                                }
                                        } else {
                                                zval_ptr_dtor(&type);
@@ -1294,7 +1294,7 @@ int set_zval_xmlrpc_type(zval* value, XMLRPC_VALUE_TYPE newtype) /* {{{ */
                                }
                        } else {
                                convert_to_object(value);
-                               bSuccess = zend_hash_str_update(Z_OBJPROP_P(value), OBJECT_TYPE_ATTR, sizeof(OBJECT_TYPE_ATTR) - 1, &type) != NULL;
+                               bSuccess = (zend_hash_str_update(Z_OBJPROP_P(value), OBJECT_TYPE_ATTR, sizeof(OBJECT_TYPE_ATTR) - 1, &type) != NULL)? SUCCESS : FAILURE;
                        }
                }
        }