- Fixed memory leaks in openssl streams context options. (Pierre)
- Fixed handling of extremely long paths inside tempnam() function. (Ilia)
-- Fixed bug #38004 Parameters in SoapServer are decoded twice. (Dmitry)
+- Fixed bug #38005 (SoapFault faultstring doesn't follow encoding rules).
+ (Dmitry)
+- Fixed bug #38004 (Parameters in SoapServer are decoded twice). (Dmitry)
- Fixed bug #38003 (in classes inherited from MySQLi it's possible to call
private constructors from invalid context). (Tony)
- Fixed bug #37987 (invalid return of file_exists() in safe mode). (Ilia)
tmp = get_node(fault->children,"faultstring");
if (tmp != NULL && tmp->children != NULL) {
- faultstring = tmp->children->content;
+ zval *zv = master_to_zval(get_conversion(IS_STRING), tmp);
+ faultstring = Z_STRVAL_P(zv);
+ FREE_ZVAL(zv);
}
tmp = get_node(fault->children,"faultactor");
if (tmp != NULL && tmp->children != NULL) {
- faultactor = tmp->children->content;
+ zval *zv = master_to_zval(get_conversion(IS_STRING), tmp);
+ faultactor = Z_STRVAL_P(zv);
+ FREE_ZVAL(zv);
}
tmp = get_node(fault->children,"detail");
/* TODO: lang attribute */
tmp = get_node(tmp->children,"Text");
if (tmp != NULL && tmp->children != NULL) {
- faultstring = tmp->children->content;
+ zval *zv = master_to_zval(get_conversion(IS_STRING), tmp);
+ faultstring = Z_STRVAL_P(zv);
+ FREE_ZVAL(zv);
}
}
}
}
add_soap_fault(this_ptr, faultcode, faultstring, faultactor, details TSRMLS_CC);
+ if (faultstring) {
+ efree(faultstring);
+ }
+ if (faultactor) {
+ efree(faultactor);
+ }
#ifdef ZEND_ENGINE_2
if (details) {
details->refcount--;
efree(str);
}
if (zend_hash_find(prop, "faultstring", sizeof("faultstring"), (void**)&tmp) == SUCCESS) {
- int new_len;
- xmlNodePtr node = xmlNewNode(NULL, "faultstring");
- char *str = php_escape_html_entities(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), &new_len, 0, 0, NULL TSRMLS_CC);
- xmlAddChild(param, node);
- xmlNodeSetContentLen(node, str, new_len);
- efree(str);
+ xmlNodePtr node = master_to_xml(get_conversion(IS_STRING), *tmp, SOAP_LITERAL, param);
+ xmlNodeSetName(node, "faultstring");
}
if (zend_hash_find(prop, "faultactor", sizeof("faultactor"), (void**)&tmp) == SUCCESS) {
- int new_len;
- xmlNodePtr node = xmlNewNode(NULL, "faultactor");
- char *str = php_escape_html_entities(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), &new_len, 0, 0, NULL TSRMLS_CC);
- xmlAddChild(param, node);
- xmlNodeSetContentLen(node, str, new_len);
- efree(str);
+ xmlNodePtr node = master_to_xml(get_conversion(IS_STRING), *tmp, SOAP_LITERAL, param);
+ xmlNodeSetName(node, "faultactor");
}
detail_name = "detail";
} else {
efree(str);
}
if (zend_hash_find(prop, "faultstring", sizeof("faultstring"), (void**)&tmp) == SUCCESS) {
- int new_len;
xmlNodePtr node = xmlNewChild(param, ns, "Reason", NULL);
- char *str = php_escape_html_entities(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), &new_len, 0, 0, NULL TSRMLS_CC);
- node = xmlNewChild(node, ns, "Text", NULL);
- xmlNodeSetContentLen(node, str, new_len);
- efree(str);
+ node = master_to_xml(get_conversion(IS_STRING), *tmp, SOAP_LITERAL, node);
+ xmlNodeSetName(node, "Text");
+ xmlSetNs(node, ns);
}
detail_name = SOAP_1_2_ENV_NS_PREFIX":Detail";
}
--- /dev/null
+--TEST--
+Bug #38005 (SoapFault faultstring doesn't follow encoding rules)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+function Test($param) {
+ return new SoapFault('Test', 'This is our fault: Ä');
+}
+
+class TestSoapClient extends SoapClient {
+ function __construct($wsdl, $opt) {
+ parent::__construct($wsdl, $opt);
+ $this->server = new SoapServer($wsdl, $opt);
+ $this->server->addFunction('Test');
+ }
+
+ function __doRequest($request, $location, $action, $version) {
+ ob_start();
+ $this->server->handle($request);
+ $response = ob_get_contents();
+ ob_end_clean();
+ return $response;
+ }
+}
+
+$client = new TestSoapClient(NULL, array(
+ 'encoding' => 'ISO-8859-1',
+ 'uri' => "test://",
+ 'location' => "test://",
+ 'soap_version'=>SOAP_1_2,
+ 'trace'=>1,
+ 'exceptions'=>0));
+$res = $client->Test();
+echo($res->faultstring."\n");
+echo($client->__getLastResponse());
+?>
+--EXPECT--
+This is our fault: Ä
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body><env:Fault><env:Code><env:Value>Test</env:Value></env:Code><env:Reason><env:Text>This is our fault: Ä</env:Text></env:Reason></env:Fault></env:Body></env:Envelope>