summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2015-09-19 06:10:48 -0700
committerXinchen Hui <laruence@gmail.com>2015-09-19 06:10:48 -0700
commitde6ee4c24f91fe46678fe242f947c2657cc0ea73 (patch)
tree769c20cf8bb3ac3a49b838dcf3df8f3fce5900ba
parent8eadde40cdb1817d23c6aca01df69596877f69a3 (diff)
downloadphp-git-de6ee4c24f91fe46678fe242f947c2657cc0ea73.tar.gz
Fixed bug #70526 (xmlrpc_set_type returns false on success)
-rw-r--r--NEWS2
-rw-r--r--ext/xmlrpc/tests/bug70526.phpt14
-rw-r--r--ext/xmlrpc/xmlrpc-epi-php.c4
3 files changed, 18 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 57b7a73c11..ac0d0506ef 100644
--- 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
index 0000000000..6ed3e1b997
--- /dev/null
+++ b/ext/xmlrpc/tests/bug70526.phpt
@@ -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)
diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c
index 62bc39dba4..7dcae1b2f7 100644
--- a/ext/xmlrpc/xmlrpc-epi-php.c
+++ b/ext/xmlrpc/xmlrpc-epi-php.c
@@ -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;
}
}
}