dmitry          Wed Aug 22 14:18:29 2007 UTC

  Modified files:              
    /php-src/ext/soap   php_encoding.c 
    /php-src/ext/soap/tests/bugs        bug42183.phpt 
  Log:
  Fixed bug #42183 (classmap cause crashr in non-wsdl mode)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/soap/php_encoding.c?r1=1.160&r2=1.161&diff_format=u
Index: php-src/ext/soap/php_encoding.c
diff -u php-src/ext/soap/php_encoding.c:1.160 
php-src/ext/soap/php_encoding.c:1.161
--- php-src/ext/soap/php_encoding.c:1.160       Thu Jun 14 07:09:42 2007
+++ php-src/ext/soap/php_encoding.c     Wed Aug 22 14:18:28 2007
@@ -17,7 +17,7 @@
   |          Dmitry Stogov <[EMAIL PROTECTED]>                             |
   +----------------------------------------------------------------------+
 */
-/* $Id: php_encoding.c,v 1.160 2007/06/14 07:09:42 dmitry Exp $ */
+/* $Id: php_encoding.c,v 1.161 2007/08/22 14:18:28 dmitry Exp $ */
 
 #include <time.h>
 
@@ -470,12 +470,14 @@
                                        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)) {
http://cvs.php.net/viewvc.cgi/php-src/ext/soap/tests/bugs/bug42183.phpt?r1=1.1&r2=1.2&diff_format=u
Index: php-src/ext/soap/tests/bugs/bug42183.phpt
diff -u /dev/null php-src/ext/soap/tests/bugs/bug42183.phpt:1.2
--- /dev/null   Wed Aug 22 14:18:29 2007
+++ php-src/ext/soap/tests/bugs/bug42183.phpt   Wed Aug 22 14:18:28 2007
@@ -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

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

Reply via email to