dmitry          Tue Nov  1 06:11:35 2005 EDT

  Added files:                 (Branch: PHP_5_1)
    /php-src/ext/soap/tests     any.phpt 

  Modified files:              
    /php-src/ext/soap   php_encoding.c 
  Log:
  Fixed SIGSEGV
  
  
http://cvs.php.net/diff.php/php-src/ext/soap/php_encoding.c?r1=1.103.2.9&r2=1.103.2.10&ty=u
Index: php-src/ext/soap/php_encoding.c
diff -u php-src/ext/soap/php_encoding.c:1.103.2.9 
php-src/ext/soap/php_encoding.c:1.103.2.10
--- php-src/ext/soap/php_encoding.c:1.103.2.9   Tue Oct 11 06:15:40 2005
+++ php-src/ext/soap/php_encoding.c     Tue Nov  1 06:11:34 2005
@@ -17,7 +17,7 @@
   |          Dmitry Stogov <[EMAIL PROTECTED]>                             |
   +----------------------------------------------------------------------+
 */
-/* $Id: php_encoding.c,v 1.103.2.9 2005/10/11 10:15:40 dmitry Exp $ */
+/* $Id: php_encoding.c,v 1.103.2.10 2005/11/01 11:11:34 dmitry Exp $ */
 
 #include <time.h>
 
@@ -2760,15 +2760,16 @@
 
        if (Z_TYPE_P(data) == IS_STRING) {
                ret = xmlNewTextLen(Z_STRVAL_P(data), Z_STRLEN_P(data));
+               ret->name = xmlStringTextNoenc;
        } else {
                zval tmp = *data;
 
                zval_copy_ctor(&tmp);
                convert_to_string(&tmp);
-               ret = xmlNewTextLen(Z_STRVAL_P(data), Z_STRLEN_P(data));
+               ret = xmlNewTextLen(Z_STRVAL(tmp), Z_STRLEN(tmp));
                zval_dtor(&tmp);
+               ret->name = xmlStringTextNoenc;
        }
-       ret->name = xmlStringTextNoenc;
        xmlAddChild(parent, ret);
 
        return ret;

http://cvs.php.net/co.php/php-src/ext/soap/tests/any.phpt?r=1.1&p=1
Index: php-src/ext/soap/tests/any.phpt
+++ php-src/ext/soap/tests/any.phpt
--TEST--
SOAP handling of <any>
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
class SOAPComplexType {
    function SOAPComplexType($s, $i, $f) {
        $this->varString = $s;
        $this->varInt = $i;
        $this->varFloat = $f;
    }
}
$struct = new SOAPComplexType('arg',34,325.325);

function echoAnyElement($x) {
        global $g;

        $g = $x;
        $struct = $x->inputAny->any;
        if ($struct instanceof SOAPComplexType) {
                return array("return" => array("any" => new SoapVar($struct, 
SOAP_ENC_OBJECT, "SOAPComplexType", "http://soapinterop.org/xsd";, 
"SOAPComplexType", "http://soapinterop.org/";)));
        } else {
                return "?";
        }
}

class TestSoapClient extends SoapClient {
  function __construct($wsdl, $options) {
    parent::__construct($wsdl, $options);
    $this->server = new SoapServer($wsdl, $options);
    $this->server->addFunction('echoAnyElement');
  }

  function __doRequest($request, $location, $action, $version) {
    ob_start();
    $this->server->handle($request);
    $response = ob_get_contents();
    ob_end_clean();
    return $response;
  }
}

$client = new 
TestSoapClient(dirname(__FILE__)."/interop/Round4/GroupI/round4_groupI_xsd.wsdl",
                             array("trace"=>1,"exceptions"=>0,
                             'classmap' => 
array('SOAPComplexType'=>'SOAPComplexType')));
$ret = $client->echoAnyElement(
  array(
    "inputAny"=>array(
       "any"=>new SoapVar($struct, SOAP_ENC_OBJECT, "SOAPComplexType", 
"http://soapinterop.org/xsd";, "SOAPComplexType", "http://soapinterop.org/";)
     )));
var_dump($g);
var_dump($ret);
?>
--EXPECT--
object(stdClass)#5 (1) {
  ["inputAny"]=>
  object(stdClass)#6 (1) {
    ["any"]=>
    object(SOAPComplexType)#7 (3) {
      ["varInt"]=>
      int(34)
      ["varString"]=>
      string(3) "arg"
      ["varFloat"]=>
      float(325.325)
    }
  }
}
object(stdClass)#8 (1) {
  ["return"]=>
  object(stdClass)#9 (1) {
    ["any"]=>
    object(SOAPComplexType)#10 (3) {
      ["varInt"]=>
      int(34)
      ["varString"]=>
      string(3) "arg"
      ["varFloat"]=>
      float(325.325)
    }
  }
}

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

Reply via email to