summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2007-08-22 14:18:28 +0000
committerDmitry Stogov <dmitry@php.net>2007-08-22 14:18:28 +0000
commitd7c3646eb639d21ca630367e502b187cb5fee6eb (patch)
tree50996e0d33f042b73ee6ecb644fa37ec29d406da
parent1322b1a30a4b8b294195294aaac326da9156130c (diff)
downloadphp-git-d7c3646eb639d21ca630367e502b187cb5fee6eb.tar.gz
Fixed bug #42183 (classmap cause crashr in non-wsdl mode)
-rw-r--r--ext/soap/php_encoding.c6
-rwxr-xr-xext/soap/tests/bugs/bug42183.phpt27
2 files changed, 31 insertions, 2 deletions
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
index d6a90590d6..6718da3dfd 100644
--- a/ext/soap/php_encoding.c
+++ b/ext/soap/php_encoding.c
@@ -470,12 +470,14 @@ xmlNodePtr master_to_xml(encodePtr encode, zval *data, int style, xmlNodePtr par
zend_uchar utype = zend_hash_get_current_key_ex(SOAP_GLOBAL(class_map), &type_name, &type_len, &idx, 0, &pos);
if (utype == HASH_KEY_IS_STRING || utype == HASH_KEY_IS_UNICODE) {
- encodePtr enc;
+ encodePtr enc = NULL;
type_name.s = soap_encode_string_ex(utype, type_name, type_len TSRMLS_CC);
/* TODO: namespace isn't stored */
- enc = get_encoder(SOAP_GLOBAL(sdl), SOAP_GLOBAL(sdl)->target_ns, type_name.s);
+ if (SOAP_GLOBAL(sdl)) {
+ enc = get_encoder(SOAP_GLOBAL(sdl), SOAP_GLOBAL(sdl)->target_ns, type_name.s);
+ }
if (enc) {
encode = enc;
} else if (SOAP_GLOBAL(sdl)) {
diff --git a/ext/soap/tests/bugs/bug42183.phpt b/ext/soap/tests/bugs/bug42183.phpt
new file mode 100755
index 0000000000..d34311f26c
--- /dev/null
+++ b/ext/soap/tests/bugs/bug42183.phpt
@@ -0,0 +1,27 @@
+--TEST--
+Bug #42183 (classmap cause crash in non-wsdl mode )
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+class PHPObject {
+}
+
+$req = <<<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://ws.sit.com" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:test/></SOAP-ENV:Body></SOAP-ENV:Envelope>
+EOF;
+
+function test() {
+ return new PHPObject();
+}
+
+$server = new SoapServer(NULL, array('uri' => 'http://ws.sit.com',
+ 'classmap' => array('Object' => 'PHPObject')));
+$server->addFunction("test");
+ob_start();
+$server->handle($req);
+ob_end_clean();
+echo "ok\n";
+--EXPECT--
+ok