dmitry Fri Aug 4 07:38:22 2006 UTC
Modified files:
/php-src/ext/soap soap.c
/php-src/ext/soap/tests/bugs bug32776.phpt bug38005.phpt
Log:
Unicode support
http://cvs.php.net/viewvc.cgi/php-src/ext/soap/soap.c?r1=1.201&r2=1.202&diff_format=u
Index: php-src/ext/soap/soap.c
diff -u php-src/ext/soap/soap.c:1.201 php-src/ext/soap/soap.c:1.202
--- php-src/ext/soap/soap.c:1.201 Thu Aug 3 16:13:06 2006
+++ php-src/ext/soap/soap.c Fri Aug 4 07:38:21 2006
@@ -17,7 +17,7 @@
| Dmitry Stogov <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: soap.c,v 1.201 2006/08/03 16:13:06 dmitry Exp $ */
+/* $Id: soap.c,v 1.202 2006/08/04 07:38:21 dmitry Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -926,7 +926,7 @@
}
#endif
-/* {{{ proto object SoapParam::SoapParam ( mixed data, string name)
+/* {{{ proto object SoapParam::SoapParam ( mixed data, string name) U
SoapParam constructor */
PHP_METHOD(SoapParam, SoapParam)
{
@@ -952,7 +952,7 @@
/* }}} */
-/* {{{ proto object SoapHeader::SoapHeader ( string namespace, string name [,
mixed data [, bool mustUnderstand [, mixed actor]]])
+/* {{{ proto object SoapHeader::SoapHeader ( string namespace, string name [,
mixed data [, bool mustUnderstand [, mixed actor]]]) U
SoapHeader constructor */
PHP_METHOD(SoapHeader, SoapHeader)
{
@@ -1003,7 +1003,7 @@
}
}
-/* {{{ proto object SoapFault::SoapFault ( string faultcode, string
faultstring [, string faultactor [, mixed detail [, string faultname [, mixed
headerfault]]]])
+/* {{{ proto object SoapFault::SoapFault ( string faultcode, string
faultstring [, string faultactor [, mixed detail [, string faultname [, mixed
headerfault]]]]) U
SoapFault constructor */
PHP_METHOD(SoapFault, SoapFault)
{
@@ -1084,7 +1084,7 @@
/* }}} */
-/* {{{ proto object SoapFault::__toString ()
+/* {{{ proto object SoapFault::__toString () U
*/
PHP_METHOD(SoapFault, __toString)
{
@@ -1133,7 +1133,7 @@
}
/* }}} */
-/* {{{ proto object SoapVar::SoapVar ( mixed data, int encoding [, string
type_name [, string type_namespace [, string node_name [, string
node_namespace]]]])
+/* {{{ proto object SoapVar::SoapVar ( mixed data, int encoding [, string
type_name [, string type_namespace [, string node_name [, string
node_namespace]]]]) U
SoapVar constructor */
PHP_METHOD(SoapVar, SoapVar)
{
@@ -1197,7 +1197,7 @@
/* }}} */
-/* {{{ proto object SoapServer::SoapServer ( mixed wsdl [, array options])
+/* {{{ proto object SoapServer::SoapServer ( mixed wsdl [, array options]) U
SoapServer constructor */
PHP_METHOD(SoapServer, SoapServer)
{
@@ -1446,7 +1446,7 @@
#endif
-/* {{{ proto object SoapServer::setPersistence ( int mode )
+/* {{{ proto object SoapServer::setPersistence ( int mode ) U
Sets persistence mode of SoapServer */
PHP_METHOD(SoapServer, setPersistence)
{
@@ -1475,7 +1475,7 @@
/* }}} */
-/* {{{ proto void SoapServer::setClass(string class_name [, mixed args])
+/* {{{ proto void SoapServer::setClass(string class_name [, mixed args]) U
Sets class which will handle SOAP requests */
PHP_METHOD(SoapServer, setClass)
{
@@ -1525,7 +1525,7 @@
/* }}} */
-/* {{{ proto array SoapServer::getFunctions(void)
+/* {{{ proto array SoapServer::getFunctions(void) U
Returns list of defined functions */
PHP_METHOD(SoapServer, getFunctions)
{
@@ -1569,7 +1569,7 @@
/* }}} */
-/* {{{ proto void SoapServer::addFunction(mixed functions)
+/* {{{ proto void SoapServer::addFunction(mixed functions) U
Adds one or several functions those will handle SOAP requests */
PHP_METHOD(SoapServer, addFunction)
{
@@ -1660,7 +1660,7 @@
/* }}} */
-/* {{{ proto void SoapServer::handle ( [string soap_request])
+/* {{{ proto void SoapServer::handle ( [string soap_request]) U
Handles a SOAP request */
PHP_METHOD(SoapServer, handle)
{
@@ -1789,8 +1789,9 @@
} else {
/* unicode */
/* TODO: remove unicode->string conversion */
- char *str_req =
soap_unicode_to_string(Z_USTRVAL_PP(raw_post), Z_USTRLEN_PP(raw_post)
TSRMLS_CC);
- doc_request = soap_xmlParseMemory(str_req,
strlen(str_req));
+ int str_req_len;
+ char *str_req = soap_encode_string(*raw_post,
&str_req_len TSRMLS_CC);
+ doc_request = soap_xmlParseMemory(str_req,
str_req_len);
efree(str_req);
}
@@ -2154,7 +2155,7 @@
/* }}} */
-/* {{{ proto SoapServer::fault ( staring code, string string [, string actor
[, mixed details [, string name]]] )
+/* {{{ proto SoapServer::fault ( staring code, string string [, string actor
[, mixed details [, string name]]] ) U
Issue SoapFault indicating an error */
PHP_METHOD(SoapServer, fault)
{
@@ -2205,6 +2206,8 @@
}
/* }}} */
+/* {{{ proto SoapServer::addSoapHeader ( SoapHeader header ) U
+ Adds one SOAP header into response */
PHP_METHOD(SoapServer, addSoapHeader)
{
soap_server_object *service;
@@ -2235,6 +2238,7 @@
SOAP_SERVER_END_CODE();
}
+/* }}} */
static void soap_server_fault_ex(sdlFunctionPtr function, zval* fault,
soapHeader *hdr TSRMLS_DC)
{
@@ -2419,6 +2423,9 @@
}
}
+/* {{{ proto use_soap_error_handler ( [bool on] ) U
+ Enable or disable SOAP's error handler, that translates PHP errors into
+ SOAP faults */
PHP_FUNCTION(use_soap_error_handler)
{
zend_bool handler = 1;
@@ -2428,7 +2435,10 @@
SOAP_GLOBAL(use_soap_error_handler) = handler;
}
}
+/* }}} */
+/* {{{ proto bool is_soap_fault ( mixed object ) U
+ Checks if given value is a SoapFault object */
PHP_FUNCTION(is_soap_fault)
{
zval *fault;
@@ -2440,10 +2450,11 @@
}
RETURN_FALSE
}
+/* }}} */
/* SoapClient functions */
-/* {{{ proto object SoapClient::SoapClient ( mixed wsdl [, array options])
+/* {{{ proto object SoapClient::SoapClient ( mixed wsdl [, array options]) U
SoapClient constructor */
PHP_METHOD(SoapClient, SoapClient)
{
@@ -2971,7 +2982,7 @@
}
-/* {{{ proto mixed SoapClient::__call ( string function_name [, array
arguments [, array options [, array input_headers [, array output_headers]]]])
+/* {{{ proto mixed SoapClient::__call ( string function_name [, array
arguments [, array options [, array input_headers [, array output_headers]]]]) U
Calls a SOAP function */
PHP_METHOD(SoapClient, __call)
{
@@ -3117,7 +3128,7 @@
/* }}} */
-/* {{{ proto array SoapClient::__getFunctions ( void )
+/* {{{ proto array SoapClient::__getFunctions ( void ) U
Returns list of SOAP functions */
PHP_METHOD(SoapClient, __getFunctions)
{
@@ -3144,7 +3155,7 @@
/* }}} */
-/* {{{ proto array SoapClient::__getTypes ( void )
+/* {{{ proto array SoapClient::__getTypes ( void ) U
Returns list of SOAP types */
PHP_METHOD(SoapClient, __getTypes)
{
@@ -3173,7 +3184,7 @@
/* }}} */
-/* {{{ proto string SoapClient::__getLastRequest ( void )
+/* {{{ proto string SoapClient::__getLastRequest ( void ) U
Returns last SOAP request */
PHP_METHOD(SoapClient, __getLastRequest)
{
@@ -3181,14 +3192,15 @@
client = (soap_client_object*)zend_object_store_get_object(this_ptr
TSRMLS_CC);
if (client->last_request) {
- RETURN_STRING(client->last_request, 1);
+ soap_decode_string(return_value, client->last_request
TSRMLS_CC);
+ return;
}
RETURN_NULL();
}
/* }}} */
-/* {{{ proto object SoapClient::__getLastResponse ( void )
+/* {{{ proto object SoapClient::__getLastResponse ( void ) U
Returns last SOAP response */
PHP_METHOD(SoapClient, __getLastResponse)
{
@@ -3196,14 +3208,15 @@
client = (soap_client_object*)zend_object_store_get_object(this_ptr
TSRMLS_CC);
if (client->last_response) {
- RETURN_STRING(client->last_response, 1);
+ soap_decode_string(return_value, client->last_response
TSRMLS_CC);
+ return;
}
RETURN_NULL();
}
/* }}} */
-/* {{{ proto string SoapClient::__getLastRequestHeaders(void)
+/* {{{ proto string SoapClient::__getLastRequestHeaders(void) U
Returns last SOAP request headers */
PHP_METHOD(SoapClient, __getLastRequestHeaders)
{
@@ -3211,14 +3224,15 @@
client = (soap_client_object*)zend_object_store_get_object(this_ptr
TSRMLS_CC);
if (client->last_request_headers) {
- RETURN_STRING(client->last_request_headers, 1);
+ soap_decode_string(return_value, client->last_request_headers
TSRMLS_CC);
+ return;
}
RETURN_NULL();
}
/* }}} */
-/* {{{ proto string SoapClient::__getLastResponseHeaders(void)
+/* {{{ proto string SoapClient::__getLastResponseHeaders(void) U
Returns last SOAP response headers */
PHP_METHOD(SoapClient, __getLastResponseHeaders)
{
@@ -3226,14 +3240,15 @@
client = (soap_client_object*)zend_object_store_get_object(this_ptr
TSRMLS_CC);
if (client->last_response_headers) {
- RETURN_STRING(client->last_response_headers, 1);
+ soap_decode_string(return_value, client->last_response_headers
TSRMLS_CC);
+ return;
}
RETURN_NULL();
}
/* }}} */
-/* {{{ proto string SoapClient::__doRequest()
+/* {{{ proto string SoapClient::__doRequest() U
SoapClient::__doRequest() */
PHP_METHOD(SoapClient, __doRequest)
{
@@ -3286,7 +3301,7 @@
}
/* }}} */
-/* {{{ proto void SoapClient::__setCookie(string name [, strung value])
+/* {{{ proto void SoapClient::__setCookie(string name [, strung value]) U
Sets cookie thet will sent with SOAP request.
The call to this function will effect all folowing calls of SOAP methods.
If value is not specified cookie is removed. */
@@ -3329,7 +3344,7 @@
}
/* }}} */
-/* {{{ proto array SoapClient::__getCookies()
+/* {{{ proto array SoapClient::__getCookies() U
Returns array of cookies. */
PHP_METHOD(SoapClient, __getCookies)
{
@@ -3347,7 +3362,7 @@
}
/* }}} */
-/* {{{ proto void SoapClient::__setSoapHeaders(array SoapHeaders)
+/* {{{ proto void SoapClient::__setSoapHeaders(array SoapHeaders) U
Sets SOAP headers for subsequent calls (replaces any previous
values).
If no value is specified, all of the headers are removed. */
@@ -3388,7 +3403,7 @@
-/* {{{ proto string SoapClient::__setLocation([string new_location])
+/* {{{ proto string SoapClient::__setLocation([string new_location]) U
Sets the location option (the endpoint URL that will be touched by the
following SOAP requests).
If new_location is not specified or null then SoapClient will use endpoint
http://cvs.php.net/viewvc.cgi/php-src/ext/soap/tests/bugs/bug32776.phpt?r1=1.3&r2=1.4&diff_format=u
Index: php-src/ext/soap/tests/bugs/bug32776.phpt
diff -u php-src/ext/soap/tests/bugs/bug32776.phpt:1.3
php-src/ext/soap/tests/bugs/bug32776.phpt:1.4
--- php-src/ext/soap/tests/bugs/bug32776.phpt:1.3 Thu Jul 13 16:47:25 2006
+++ php-src/ext/soap/tests/bugs/bug32776.phpt Fri Aug 4 07:38:21 2006
@@ -48,8 +48,8 @@
--UEXPECT--
NULL
unicode(5) "Hello"
-string(459) "<?xml version="1.0" encoding="UTF-8"?>
+unicode(459) "<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><SOAP-ENV:test><x
xsi:type="xsd:string">Hello</x></SOAP-ENV:test></SOAP-ENV:Body></SOAP-ENV:Envelope>
"
-string(0) ""
+unicode(0) ""
ok
http://cvs.php.net/viewvc.cgi/php-src/ext/soap/tests/bugs/bug38005.phpt?r1=1.3&r2=1.4&diff_format=u
Index: php-src/ext/soap/tests/bugs/bug38005.phpt
diff -u php-src/ext/soap/tests/bugs/bug38005.phpt:1.3
php-src/ext/soap/tests/bugs/bug38005.phpt:1.4
--- php-src/ext/soap/tests/bugs/bug38005.phpt:1.3 Thu Jul 13 16:47:25 2006
+++ php-src/ext/soap/tests/bugs/bug38005.phpt Fri Aug 4 07:38:21 2006
@@ -36,9 +36,15 @@
'exceptions'=>0));
$res = $client->Test();
echo($res->faultstring."\n");
-echo($client->__getLastResponse());
+var_dump($client->__getLastResponse());
?>
--EXPECT--
This is our fault: Ä
-<?xml version="1.0" encoding="UTF-8"?>
+string(280) "<?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>
+"
+--UEXPECT--
+This is our fault: Ä
+unicode(279) "<?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>
+"
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php