Fixed bug #35273 (Error in mapping soap - java types)

This commit is contained in:
Dmitry Stogov 2005-11-18 11:00:15 +00:00
parent 25558ffdbb
commit 8b4e1abdb0
3 changed files with 50 additions and 10 deletions

3
NEWS
View File

@ -1,5 +1,8 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? Nov 2005, PHP 5.1
- Fixed bug #35273 (Error in mapping soap - java types). (Dmitry)
17 Nov 2005, PHP 5.1 Release Candidate 6
- Changed function parameter parsing to handle integers in a non-strict fashion
and to emit an E_NOTICE on badly formed integer values. (Ilia)

View File

@ -117,24 +117,40 @@ encodePtr get_encoder(sdlPtr sdl, const char *ns, const char *type)
nscat[len] = '\0';
enc = get_encoder_ex(sdl, nscat, len);
efree(nscat);
if (enc == NULL &&
((ns_len == sizeof(SOAP_1_1_ENC_NAMESPACE)-1 &&
memcmp(ns, SOAP_1_1_ENC_NAMESPACE, sizeof(SOAP_1_1_ENC_NAMESPACE)-1) == 0) ||
(ns_len == sizeof(SOAP_1_2_ENC_NAMESPACE)-1 &&
memcmp(ns, SOAP_1_2_ENC_NAMESPACE, sizeof(SOAP_1_2_ENC_NAMESPACE)-1) == 0))) {
ns_len = sizeof(XSD_NAMESPACE)-1;
len = ns_len + type_len + 1;
nscat = emalloc(len + 1);
memcpy(nscat, XSD_NAMESPACE, sizeof(XSD_NAMESPACE)-1);
nscat[ns_len] = ':';
memcpy(nscat+ns_len+1, type, type_len);
nscat[len] = '\0';
char *enc_nscat;
int enc_ns_len;
int enc_len;
enc = get_encoder_ex(sdl, nscat, len);
efree(nscat);
enc_ns_len = sizeof(XSD_NAMESPACE)-1;
enc_len = enc_ns_len + type_len + 1;
enc_nscat = emalloc(enc_len + 1);
memcpy(enc_nscat, XSD_NAMESPACE, sizeof(XSD_NAMESPACE)-1);
enc_nscat[enc_ns_len] = ':';
memcpy(enc_nscat+enc_ns_len+1, type, type_len);
enc_nscat[enc_len] = '\0';
enc = get_encoder_ex(NULL, enc_nscat, enc_len);
efree(enc_nscat);
if (enc && sdl) {
encodePtr new_enc = emalloc(sizeof(encode));
memcpy(new_enc, enc, sizeof(encode));
new_enc->details.ns = estrndup(ns, ns_len);
new_enc->details.type_str = estrdup(new_enc->details.type_str);
if (sdl->encoders == NULL) {
sdl->encoders = emalloc(sizeof(HashTable));
zend_hash_init(sdl->encoders, 0, NULL, delete_encoder, 0);
}
zend_hash_update(sdl->encoders, nscat, len + 1, &new_enc, sizeof(encodePtr), NULL);
enc = new_enc;
}
}
efree(nscat);
return enc;
}

View File

@ -0,0 +1,21 @@
--TEST--
Bug #35273 Error in mapping soap - java types
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
class TestSoapClient extends SoapClient {
function __doRequest($request, $location, $action, $version) {
echo $request;
exit;
}
}
ini_set("soap.wsdl_cache_enabled", 0);
$client = new TestSoapClient(dirname(__FILE__).'/bug32941.wsdl', array("trace" => 1, 'exceptions' => 0));
$ahoj = $client->echoPerson(array("name"=>"Name","surname"=>"Surname"));
echo "ok\n";
?>
--EXPECT--
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://service" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns2="urn:service.EchoService" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:echoPerson><p xsi:type="ns2:Person"><name xsi:type="SOAP-ENC:string">Name</name><surname xsi:type="SOAP-ENC:string">Surname</surname></p></ns1:echoPerson></SOAP-ENV:Body></SOAP-ENV:Envelope>