]> granicus.if.org Git - php/commitdiff
add test
authorAntony Dovgal <tony2001@php.net>
Wed, 12 Apr 2006 15:19:39 +0000 (15:19 +0000)
committerAntony Dovgal <tony2001@php.net>
Wed, 12 Apr 2006 15:19:39 +0000 (15:19 +0000)
ext/xmlrpc/tests/bug37057.phpt [new file with mode: 0644]

diff --git a/ext/xmlrpc/tests/bug37057.phpt b/ext/xmlrpc/tests/bug37057.phpt
new file mode 100644 (file)
index 0000000..0764d8a
--- /dev/null
@@ -0,0 +1,62 @@
+--TEST--
+Bug #37057 (xmlrpc_decode() may produce arrays with numeric string keys which are unaccessible)
+--FILE--
+<?php
+$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=xmlrpc_decode($response);
+var_dump($retval);
+var_dump($retval["50"]);
+var_dump($retval[50]);
+
+$response='<?xml version="1.0"?>
+<methodResponse>
+  <params>
+    <param>
+      <value>
+        <struct>
+          <member>
+            <name>0</name>
+            <value><string>0.29</string></value>
+          </member>
+        </struct>
+      </value>
+    </param>
+  </params>
+</methodResponse>';
+
+$retval=xmlrpc_decode($response);
+var_dump($retval);
+var_dump($retval["0"]);
+var_dump($retval[0]);
+
+echo "Done\n";
+?>
+--EXPECT--     
+array(1) {
+  [50]=>
+  string(4) "0.29"
+}
+string(4) "0.29"
+string(4) "0.29"
+array(1) {
+  [0]=>
+  string(4) "0.29"
+}
+string(4) "0.29"
+string(4) "0.29"
+Done