php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37057 direct access to arrays from xmlrpc_decode does not work
Submitted: 2006-04-12 14:28 UTC Modified: 2006-04-12 15:14 UTC
From: admin at erazor-zone dot de Assigned: tony2001 (profile)
Status: Closed Package: XMLRPC-EPI related
PHP Version: 5.1.3RC3 OS: Linux 2.6 - gentoo
Private report: No CVE-ID: None
 [2006-04-12 14:28 UTC] admin at erazor-zone dot de
Description:
------------
xmlrpc_decode produces something like:
Array
(
    [50] => 0.29
)

addressing the addressing it like $variable[50] does not 
work :-( (empty result), same with '50' as key.

Reproduce code:
---------------
$response='<?xml version="1.0"?>
<methodResponse>
  <params>
    <param>
      <value>
        <struct>
          <member>
            <name>50</name>
            <value><string>0.29</string></value>
          </member>
        </struct>
      </value>
    </param>
  </params>
</methodResponse>';

$retval_bugged=xmlrpc_decode($response);
print_r($retval_bugged);
/* returns: 
Array
(
    [50] => 0.29
)
*/


Expected result:
----------------
echo $retval_bugged[50];
//should write 0.29

echo $retval_bugged['50'];
//should write 0.29


Actual result:
--------------
echo $retval_bugged[50];
echo $retval_bugged['50'];
//no result


foreach($retval_bugged as $key=>$value) {
  $retval[$key]=$value;
}

echo $retval[50];
//works


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-04-12 15:14 UTC] tony2001@php.net
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 11:01:28 2024 UTC