felipe          Mon Jun 15 17:36:01 2009 UTC

  Added files:                 (Branch: PHP_5_2)
    /php-src/ext/soap/tests     bug48557.phpt bug48557.wsdl 

  Modified files:              
    /php-src    NEWS 
    /php-src/ext/soap   php_encoding.c 
  Log:
  - MFH: Fixed bug #48557 (Numeric string keys in Apache Hashmaps are not cast 
to integers) patch by David Zülke <david.zuelke at bitextender.com>
  
http://cvs.php.net/viewvc.cgi/php-src/NEWS?r1=1.2027.2.547.2.1556&r2=1.2027.2.547.2.1557&diff_format=u
Index: php-src/NEWS
diff -u php-src/NEWS:1.2027.2.547.2.1556 php-src/NEWS:1.2027.2.547.2.1557
--- php-src/NEWS:1.2027.2.547.2.1556    Sat Jun 13 17:35:37 2009
+++ php-src/NEWS        Mon Jun 15 17:35:59 2009
@@ -1,6 +1,8 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? Jun 2009, PHP 5.2.10
+- Fixed bug #48557 (Numeric string keys in Apache Hashmaps are not cast to
+  integers). (David Zülke)
 - Fixed bug #48514 (cURL extension uses same resource name for simple and
   multi APIs). (Felipe)
 - Fixed missing erealloc() in fix for Bug #40091 in spl_autoload_register.
http://cvs.php.net/viewvc.cgi/php-src/ext/soap/php_encoding.c?r1=1.103.2.21.2.46&r2=1.103.2.21.2.47&diff_format=u
Index: php-src/ext/soap/php_encoding.c
diff -u php-src/ext/soap/php_encoding.c:1.103.2.21.2.46 
php-src/ext/soap/php_encoding.c:1.103.2.21.2.47
--- php-src/ext/soap/php_encoding.c:1.103.2.21.2.46     Mon Jan 26 11:09:13 2009
+++ php-src/ext/soap/php_encoding.c     Mon Jun 15 17:36:00 2009
@@ -17,7 +17,7 @@
   |          Dmitry Stogov <dmi...@zend.com>                             |
   +----------------------------------------------------------------------+
 */
-/* $Id: php_encoding.c,v 1.103.2.21.2.46 2009/01/26 11:09:13 dmitry Exp $ */
+/* $Id: php_encoding.c,v 1.103.2.21.2.47 2009/06/15 17:36:00 felipe Exp $ */
 
 #include <time.h>
 
@@ -2726,7 +2726,7 @@
                        value = master_to_zval(NULL, xmlValue);
 
                        if (Z_TYPE_P(key) == IS_STRING) {
-                               zend_hash_update(Z_ARRVAL_P(ret), 
Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &value, sizeof(zval *), NULL);
+                               zend_symtable_update(Z_ARRVAL_P(ret), 
Z_STRVAL_P(key), Z_STRLEN_P(key) + 1, &value, sizeof(zval *), NULL);
                        } else if (Z_TYPE_P(key) == IS_LONG) {
                                zend_hash_index_update(Z_ARRVAL_P(ret), 
Z_LVAL_P(key), &value, sizeof(zval *), NULL);
                        } else {

http://cvs.php.net/viewvc.cgi/php-src/ext/soap/tests/bug48557.phpt?view=markup&rev=1.1
Index: php-src/ext/soap/tests/bug48557.phpt
+++ php-src/ext/soap/tests/bug48557.phpt
--TEST--
Bug #48557 (Numeric string keys in Apache Hashmaps are not cast to integers)
--FILE--
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
ini_set("soap.wsdl_cache_enabled", 0);

function test($map) {
        var_dump($map, $map[1], $map[2]);die;
        if(isset($map[2])) {
                die("Success\n");
        } else {
                die("Fail\n");
        }
}

$y = new SoapServer(dirname(__FILE__) . '/bug48557.wsdl');
$y->addfunction("test");
$request = <<<XML
<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:ns1="http://test-uri/"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:ns2="http://xml.apache.org/xml-soap"; 
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"; 
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";>
        <SOAP-ENV:Body>
                <ns1:test>
                        <testParam xsi:type="ns2:Map">
                                <item>
                                        <key xsi:type="xsd:int">1</key>
                                        <value xsi:type="xsd:int">123</value>
                                </item>
                                <item>
                                        <key xsi:type="xsd:int">-1000</key>
                                        <value xsi:type="xsd:string">123</value>
                                </item>
                                <item>
                                        <key xsi:type="xsd:string">2</key>
                                        <value 
xsi:type="xsd:float">123.5</value>
                                </item>
                                <item>
                                        <key xsi:type="xsd:string">-2000</key>
                                        <value 
xsi:type="xsd:float">123.5</value>
                                </item>
                                <item>
                                        <key xsi:type="xsd:string">011</key>
                                        <value 
xsi:type="xsd:float">123.5</value>
                                </item>
                                <item>
                                        <key xsi:type="xsd:int">012</key>
                                        <value 
xsi:type="xsd:float">123.5</value>
                                </item>
                        </testParam>
                </ns1:test>
        </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
XML;

#$v = array(1 => 123, "2" => 123.5, "asd" => 555);
#var_dump($v);die;
$y->handle($request);

?>
===DONE===
--EXPECTF--
array(6) {
  [1]=>
  int(123)
  [-1000]=>
  %string|unicode%(3) "123"
  [2]=>
  float(123.5)
  [-2000]=>
  float(123.5)
  [%u|b%"011"]=>
  float(123.5)
  [12]=>
  float(123.5)
}
int(123)
float(123.5)

http://cvs.php.net/viewvc.cgi/php-src/ext/soap/tests/bug48557.wsdl?view=markup&rev=1.1
Index: php-src/ext/soap/tests/bug48557.wsdl
+++ php-src/ext/soap/tests/bug48557.wsdl
<?xml version="1.0"?>
<definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"; 
xmlns:tns="http://test-uri/"; xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; 
xmlns="http://schemas.xmlsoap.org/wsdl/"; name="InteropTest" 
targetNamespace="http://test-uri/";>
        <types>
                <schema xmlns="http://www.w3.org/2001/XMLSchema"; 
targetNamespace="http://test-uri/";>
                        <xsd:import 
namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
                        <xsd:import 
namespace="http://schemas.xmlsoap.org/wsdl/"/>
                </schema>
        </types>
        <message name="testMessage">
                <part xmlns:apache="http://xml.apache.org/xml-soap"; 
name="testParam" type="apache:Map"/>
        </message>
        <portType name="testPortType">
                <operation name="test">
                        <input message="testMessage"/>
                </operation>
        </portType>
        <binding name="testBinding" type="testPortType">
                <soap:binding style="rpc" 
transport="http://schemas.xmlsoap.org/soap/http"/>
                <operation name="test">
                        <soap:operation soapAction="#test" style="rpc"/>
                        <input>
                                <soap:body use="encoded" 
namespace="http://test-uri/"; 
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
                        </input>
                </operation>
        </binding>
        <service name="testService">
                <port name="testPort" binding="tns:testBinding">
                        <soap:address location="test://"/>
                </port>
        </service>
</definitions>



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to