dmitry Wed Oct 5 03:02:31 2005 EDT
Added files: (Branch: PHP_5_1)
/php-src/ext/soap/tests server022.phpt
Modified files:
/php-src/ext/soap soap.c
Log:
Fixed throwing exceptions derived from SoapFault
http://cvs.php.net/diff.php/php-src/ext/soap/soap.c?r1=1.156.2.5&r2=1.156.2.6&ty=u
Index: php-src/ext/soap/soap.c
diff -u php-src/ext/soap/soap.c:1.156.2.5 php-src/ext/soap/soap.c:1.156.2.6
--- php-src/ext/soap/soap.c:1.156.2.5 Mon Oct 3 05:53:12 2005
+++ php-src/ext/soap/soap.c Wed Oct 5 03:02:30 2005
@@ -17,7 +17,7 @@
| Dmitry Stogov <[EMAIL PROTECTED]> |
+----------------------------------------------------------------------+
*/
-/* $Id: soap.c,v 1.156.2.5 2005/10/03 09:53:12 dmitry Exp $ */
+/* $Id: soap.c,v 1.156.2.6 2005/10/05 07:02:30 dmitry Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -110,7 +110,7 @@
EG(current_execute_data) = _old_current_execute_data; \
if (EG(exception) == NULL || \
Z_TYPE_P(EG(exception)) != IS_OBJECT || \
- Z_OBJCE_P(EG(exception)) != soap_fault_class_entry) {\
+ !instanceof_function(Z_OBJCE_P(EG(exception)),
soap_fault_class_entry TSRMLS_CC)) {\
_bailout = 1;\
}\
} zend_end_try();\
@@ -1540,7 +1540,7 @@
}
if (EG(exception)) {
if (Z_TYPE_P(EG(exception)) ==
IS_OBJECT &&
- Z_OBJCE_P(EG(exception)) ==
soap_fault_class_entry) {
+
instanceof_function(Z_OBJCE_P(EG(exception)), soap_fault_class_entry
TSRMLS_CC)) {
soap_server_fault_ex(function,
EG(exception), NULL TSRMLS_CC);
} else {
zval_dtor(&constructor);
@@ -1573,7 +1573,7 @@
#ifdef ZEND_ENGINE_2
if (EG(exception)) {
if (Z_TYPE_P(EG(exception)) ==
IS_OBJECT &&
- Z_OBJCE_P(EG(exception)) ==
soap_fault_class_entry) {
+
instanceof_function(Z_OBJCE_P(EG(exception)), soap_fault_class_entry
TSRMLS_CC)) {
soap_server_fault_ex(function, EG(exception), NULL TSRMLS_CC);
} else {
zval_dtor(&constructor);
@@ -1643,7 +1643,7 @@
php_error_docref(NULL TSRMLS_CC,
E_ERROR, "Function '%s' call failed", Z_STRVAL(h->function_name));
}
if (Z_TYPE(h->retval) == IS_OBJECT &&
- Z_OBJCE(h->retval) ==
soap_fault_class_entry) {
+ instanceof_function(Z_OBJCE(h->retval),
soap_fault_class_entry TSRMLS_CC)) {
zval *headerfault = NULL, **tmp;
if
(zend_hash_find(Z_OBJPROP(h->retval), "headerfault", sizeof("headerfault"),
(void**)&tmp) == SUCCESS &&
@@ -1654,7 +1654,7 @@
#ifdef ZEND_ENGINE_2
} else if (EG(exception)) {
if (Z_TYPE_P(EG(exception)) ==
IS_OBJECT &&
- Z_OBJCE_P(EG(exception)) ==
soap_fault_class_entry) {
+
instanceof_function(Z_OBJCE_P(EG(exception)), soap_fault_class_entry
TSRMLS_CC)) {
zval *headerfault = NULL, **tmp;
if
(zend_hash_find(Z_OBJPROP_P(EG(exception)), "headerfault",
sizeof("headerfault"), (void**)&tmp) == SUCCESS &&
@@ -1701,7 +1701,7 @@
#ifdef ZEND_ENGINE_2
if (EG(exception)) {
if (Z_TYPE_P(EG(exception)) == IS_OBJECT &&
- Z_OBJCE_P(EG(exception)) == soap_fault_class_entry) {
+ instanceof_function(Z_OBJCE_P(EG(exception)),
soap_fault_class_entry TSRMLS_CC)) {
soap_server_fault_ex(function, EG(exception), NULL
TSRMLS_CC);
} else {
if (soap_obj) {zval_ptr_dtor(&soap_obj);}
@@ -1714,7 +1714,7 @@
char *response_name;
if (Z_TYPE(retval) == IS_OBJECT &&
- Z_OBJCE(retval) == soap_fault_class_entry) {
+ instanceof_function(Z_OBJCE(retval), soap_fault_class_entry
TSRMLS_CC)) {
soap_server_fault_ex(function, &retval, NULL TSRMLS_CC);
}
@@ -2017,7 +2017,7 @@
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &fault) ==
SUCCESS &&
Z_TYPE_P(fault) == IS_OBJECT &&
- Z_OBJCE_P(fault) == soap_fault_class_entry) {
+ instanceof_function(Z_OBJCE_P(fault), soap_fault_class_entry
TSRMLS_CC)) {
RETURN_TRUE;
}
RETURN_FALSE
@@ -2439,7 +2439,7 @@
}
#ifdef ZEND_ENGINE_2
if (Z_TYPE_P(return_value) == IS_OBJECT &&
- Z_OBJCE_P(return_value) == soap_fault_class_entry &&
+ instanceof_function(Z_OBJCE_P(return_value), soap_fault_class_entry
TSRMLS_CC) &&
(zend_hash_find(Z_OBJPROP_P(this_ptr), "_exceptions",
sizeof("_exceptions"), (void **) &tmp) != SUCCESS ||
Z_TYPE_PP(tmp) != IS_BOOL || Z_LVAL_PP(tmp) != 0)) {
zval *exception;
@@ -3436,7 +3436,7 @@
xmlDocSetRootElement(doc, envelope);
if (Z_TYPE_P(ret) == IS_OBJECT &&
- Z_OBJCE_P(ret) == soap_fault_class_entry) {
+ instanceof_function(Z_OBJCE_P(ret), soap_fault_class_entry
TSRMLS_CC)) {
char *detail_name;
HashTable* prop;
zval **tmp;
http://cvs.php.net/co.php/php-src/ext/soap/tests/server022.phpt?r=1.1&p=1
Index: php-src/ext/soap/tests/server022.phpt
+++ php-src/ext/soap/tests/server022.phpt
--TEST--
SOAP Server 22: user fault (through throw of subclass)
--SKIPIF--
<?php require_once('skipif.inc'); ?>
--FILE--
<?php
class MyFault extends SoapFault {
function __construct() {
parent::__construct("MyFault","My fault string");
}
}
function test() {
throw new MyFault;
}
$server = new soapserver(null,array('uri'=>"http://testuri.org"));
$server->addfunction("test");
$HTTP_RAW_POST_DATA = <<<EOF
<?xml version="1.0" encoding="ISO-8859-1"?>
<SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
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:si="http://soapinterop.org/xsd">
<SOAP-ENV:Body>
<ns1:test xmlns:ns1="http://testuri.org"/>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
EOF;
$server->handle();
echo "ok\n";
?>
--EXPECT--
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Body><SOAP-ENV:Fault><faultcode>MyFault</faultcode><faultstring>My
fault string</faultstring></SOAP-ENV:Fault></SOAP-ENV:Body></SOAP-ENV:Envelope>
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php