xref: /PHP-5.4/ext/xmlrpc/tests/bug37057.phpt (revision aaa1d626)
1--TEST--
2Bug #37057 (xmlrpc_decode() may produce arrays with numeric string keys which are unaccessible)
3--SKIPIF--
4<?php if (!extension_loaded("xmlrpc")) print "skip"; ?>
5--FILE--
6<?php
7$response='<?xml version="1.0"?>
8<methodResponse>
9  <params>
10    <param>
11      <value>
12        <struct>
13          <member>
14            <name>50</name>
15            <value><string>0.29</string></value>
16          </member>
17        </struct>
18      </value>
19    </param>
20  </params>
21</methodResponse>';
22
23$retval=xmlrpc_decode($response);
24var_dump($retval);
25var_dump($retval["50"]);
26var_dump($retval[50]);
27
28$response='<?xml version="1.0"?>
29<methodResponse>
30  <params>
31    <param>
32      <value>
33        <struct>
34          <member>
35            <name>0</name>
36            <value><string>0.29</string></value>
37          </member>
38        </struct>
39      </value>
40    </param>
41  </params>
42</methodResponse>';
43
44$retval=xmlrpc_decode($response);
45var_dump($retval);
46var_dump($retval["0"]);
47var_dump($retval[0]);
48
49echo "Done\n";
50?>
51--EXPECT--
52array(1) {
53  [50]=>
54  string(4) "0.29"
55}
56string(4) "0.29"
57string(4) "0.29"
58array(1) {
59  [0]=>
60  string(4) "0.29"
61}
62string(4) "0.29"
63string(4) "0.29"
64Done
65