From: Dmitry Stogov Date: Wed, 22 Aug 2007 14:18:10 +0000 (+0000) Subject: Fixed bug #42183 (classmap cause crashr in non-wsdl mode) X-Git-Tag: php-5.2.4RC3~11 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8a61fc9b6e4961c3a2d92b3b856104dd32781f7d;p=php Fixed bug #42183 (classmap cause crashr in non-wsdl mode) --- diff --git a/NEWS b/NEWS index 998e9ee3bc..60684613d4 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ PHP NEWS ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| ?? Aug 2007, PHP 5.2.4 +- Fixed bug #42183 (classmap cause crashr in non-wsdl mode). (Dmitry) - Fixed bug #42009 (is_a() and is_subclass_of() should NOT call autoload, in the same way as "instanceof" operator). (Dmitry) - Fixed bug #41904 (proc_open(): empty env array should cause empty diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index 14b05e0210..197d07b0c2 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -447,7 +447,10 @@ xmlNodePtr master_to_xml(encodePtr encode, zval *data, int style, xmlNodePtr par zend_hash_get_current_key_ex(SOAP_GLOBAL(class_map), &type_name, &type_len, &idx, 0, &pos) == HASH_KEY_IS_STRING) { /* TODO: namespace isn't stored */ - encodePtr enc = get_encoder(SOAP_GLOBAL(sdl), SOAP_GLOBAL(sdl)->target_ns, type_name); + encodePtr enc = NULL; + if (SOAP_GLOBAL(sdl)) { + enc = get_encoder(SOAP_GLOBAL(sdl), SOAP_GLOBAL(sdl)->target_ns, type_name); + } 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-- + +--FILE-- + + +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