php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #70526 xmlrpc_set_type returns false on success
Submitted: 2015-09-18 19:23 UTC Modified: 2015-09-18 19:41 UTC
From: rainer dot jung at kippdata dot de Assigned:
Status: Closed Package: XMLRPC-EPI related
PHP Version: 7.0.0RC3 OS: Any
Private report: No CVE-ID: None
 [2015-09-18 19:23 UTC] 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)
}


Patches

xmlrpc_set_type-return-value (last revision 2015-09-18 20:10 UTC by rainer dot jung at kippdata dot de)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-09-18 19:41 UTC] rainer dot jung at kippdata dot de
-Package: Unknown/Other Function +Package: XMLRPC-EPI related
 [2015-09-18 19:41 UTC] rainer dot jung at kippdata dot de
Corrected "Package" in Bug metadata.
 [2015-09-18 20:00 UTC] 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 20:13 UTC] 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-19 13:19 UTC] laruence@php.net
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)
 [2015-09-19 13:19 UTC] laruence@php.net
-Status: Open +Status: Closed
 [2015-09-19 13:20 UTC] laruence@php.net
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)
 [2015-09-29 13:10 UTC] ab@php.net
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)
 [2016-07-20 11:36 UTC] davey@php.net
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)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 07:01:29 2024 UTC