Bug #70526 [Opn->Csd]: xmlrpc_set_type returns false on success
| From: | laruence@php.net | Date: | Sat, 19 Sep 2015 13:19:44 +0000 |
| Subject: | Bug #70526 [Opn->Csd]: xmlrpc_set_type returns false on success | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-196086@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=70526&edit=1
ID: 70526
Updated by: laruence@php.net
Reported by: rainer dot jung at kippdata dot de
Summary: xmlrpc_set_type returns false on success
-Status: Open
+Status: Closed
Type: Bug
Package: XMLRPC-EPI related
Operating System: Any
PHP Version: 7.0.0RC3
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=de6ee4c24f91fe46678fe242f947c2657cc0ea73
Log: Fixed bug #70526 (xmlrpc_set_type returns false on success)
Previous Comments:
------------------------------------------------------------------------
[2015-09-18 20:13:58] rainer dot jung at kippdata dot de
The NULL check is there, but it is wrong. If the return value is not NULL, it assigns 1 to bSuccess
instead of SUCCESS==0. Please check the attached patch. Thanks!
------------------------------------------------------------------------
[2015-09-18 20:00:59] rainer dot jung at kippdata dot de
The return value of xmlrpc_set_type() comes from set_zval_xmlrpc_type() in
ext/xmlrpc/xmlrpc-epi-php.c. That function sets the return value in the variable bSuccess which is
filled in PHP 7 with the return value of zend_hash_str_update(). This function returns in PHP 7 a
zval*, not SUCCESS or FAILURE as needed by this code. Until 5.6 bSuccess was filled with the return
value of zend_hash_update() which indeed does return SUCCESS or FAILURE.
It seems zend_hash_str_update() has no way of returning an error, so maybe you could set bSuccess
always to SUCCESS if the code in set_zval_xmlrpc_type() gets as far as calling
zend_hash_str_update() (and maybe doesn't return NULL).
------------------------------------------------------------------------
[2015-09-18 19:41:12] rainer dot jung at kippdata dot de
Corrected "Package" in Bug metadata.
------------------------------------------------------------------------
[2015-09-18 19:23:45] rainer dot jung at kippdata dot de
Description:
------------
xmlrpc_set_type() returns false on success. By documentation under
http://php.net/manual/en/function.xmlrpc-set-type.php
it should return true on success. This is correct for PHP until 5.6(.13), but no longer correct for
PHP 7.
Test script:
---------------
<?php
$params = date("Ymd\TH:i:s", time());
$rv = xmlrpc_set_type($params, 'datetime');
echo "xmlrpc_encode of result:\n";
echo xmlrpc_encode($params);
echo "\nvar_dump of return value:\n";
var_dump($rv);
echo "\nvar_dump of result:\n";
var_dump($params);
?>
Expected result:
----------------
xmlrpc_encode of result:
<?xml version="1.0" encoding="utf-8"?>
<params>
<param>
<value>
<dateTime.iso8601>20150918T19:16:44</dateTime.iso8601>
</value>
</param>
</params>
var_dump of return value:
bool(true)
var_dump of result:
object(stdClass)#1 (3) {
["scalar"]=>
string(17) "20150918T19:16:44"
["xmlrpc_type"]=>
string(8) "datetime"
["timestamp"]=>
int(1442603804)
}
Actual result:
--------------
xmlrpc_encode of result:
<?xml version="1.0" encoding="utf-8"?>
<params>
<param>
<value>
<dateTime.iso8601>20150918T19:16:44</dateTime.iso8601>
</value>
</param>
</params>
var_dump of return value:
bool(false)
var_dump of result:
object(stdClass)#1 (3) {
["scalar"]=>
string(17) "20150918T19:16:44"
["xmlrpc_type"]=>
string(8) "datetime"
["timestamp"]=>
int(1442603804)
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=70526&edit=1