com php-src: Move SOAP_SERVER_BEGIN_CODE() after zpp: ext/soap/soap.c
| From: | Nikita Popov | Date: | Tue, 21 Jul 2020 10:05:42 +0000 |
| Subject: | com php-src: Move SOAP_SERVER_BEGIN_CODE() after zpp: ext/soap/soap.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-112283@lists.php.net to get a copy of this message | ||
Commit: ae815490487b1d02cbde14c631543755021a1e41
Author: Nikita Popov <nikita.ppv@gmail.com> Tue, 21 Jul 2020 11:59:18 +0200
Parents: b3ea6ce720b3811e0c98ba4bdcf9107553d8967a
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ae815490487b1d02cbde14c631543755021a1e41
Log:
Move SOAP_SERVER_BEGIN_CODE() after zpp
This is still very dubious, because there are lots of other "returns"
between the BEGIN and END -- won't that end up not restoring the
original state?
Changed paths:
M ext/soap/soap.c
Diff:
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index 4a5742fdeb..846f3331b4 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -957,23 +957,25 @@ PHP_METHOD(SoapServer, setPersistence)
soapServicePtr service;
zend_long value;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &value) == FAILURE) {
+ RETURN_THROWS();
+ }
+
SOAP_SERVER_BEGIN_CODE();
FETCH_THIS_SERVICE(service);
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &value) != FAILURE) {
- if (service->type == SOAP_CLASS) {
- if (value == SOAP_PERSISTENCE_SESSION ||
- value == SOAP_PERSISTENCE_REQUEST) {
- service->soap_class.persistence = value;
- } else {
- php_error_docref(NULL, E_WARNING, "Tried to set persistence with bogus value ("
ZEND_LONG_FMT ")", value);
- return;
- }
+ if (service->type == SOAP_CLASS) {
+ if (value == SOAP_PERSISTENCE_SESSION ||
+ value == SOAP_PERSISTENCE_REQUEST) {
+ service->soap_class.persistence = value;
} else {
- php_error_docref(NULL, E_WARNING, "Tried to set persistence when you are using you SOAP
SERVER in function mode, no persistence needed");
+ php_error_docref(NULL, E_WARNING, "Tried to set persistence with bogus value ("
ZEND_LONG_FMT ")", value);
return;
}
+ } else {
+ php_error_docref(NULL, E_WARNING, "Tried to set persistence when you are using you SOAP
SERVER in function mode, no persistence needed");
+ return;
}
SOAP_SERVER_END_CODE();
@@ -990,14 +992,14 @@ PHP_METHOD(SoapServer, setClass)
int num_args = 0;
zval *argv = NULL;
- SOAP_SERVER_BEGIN_CODE();
-
- FETCH_THIS_SERVICE(service);
-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S*", &classname, &argv,
&num_args) == FAILURE) {
RETURN_THROWS();
}
+ SOAP_SERVER_BEGIN_CODE();
+
+ FETCH_THIS_SERVICE(service);
+
ce = zend_lookup_class(classname);
if (ce) {
@@ -1029,14 +1031,14 @@ PHP_METHOD(SoapServer, setObject)
soapServicePtr service;
zval *obj;
- SOAP_SERVER_BEGIN_CODE();
-
- FETCH_THIS_SERVICE(service);
-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &obj) == FAILURE) {
RETURN_THROWS();
}
+ SOAP_SERVER_BEGIN_CODE();
+
+ FETCH_THIS_SERVICE(service);
+
service->type = SOAP_OBJECT;
ZVAL_OBJ_COPY(&service->soap_object, Z_OBJ_P(obj));
@@ -1052,12 +1054,12 @@ PHP_METHOD(SoapServer, getFunctions)
soapServicePtr service;
HashTable *ft = NULL;
- SOAP_SERVER_BEGIN_CODE();
-
if (zend_parse_parameters_none() == FAILURE) {
RETURN_THROWS();
}
+ SOAP_SERVER_BEGIN_CODE();
+
FETCH_THIS_SERVICE(service);
array_init(return_value);
@@ -1095,14 +1097,14 @@ PHP_METHOD(SoapServer, addFunction)
soapServicePtr service;
zval *function_name, function_copy;
- SOAP_SERVER_BEGIN_CODE();
-
- FETCH_THIS_SERVICE(service);
-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "z", &function_name) == FAILURE) {
RETURN_THROWS();
}
+ SOAP_SERVER_BEGIN_CODE();
+
+ FETCH_THIS_SERVICE(service);
+
/* TODO: could use zend_is_callable here */
if (Z_TYPE_P(function_name) == IS_ARRAY) {
@@ -1214,15 +1216,15 @@ PHP_METHOD(SoapServer, handle)
int old_features;
zval tmp_soap;
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &arg, &arg_len) == FAILURE) {
+ RETURN_THROWS();
+ }
+
SOAP_SERVER_BEGIN_CODE();
FETCH_THIS_SERVICE(service);
SOAP_GLOBAL(soap_version) = service->version;
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "|s", &arg, &arg_len) == FAILURE) {
- RETURN_THROWS();
- }
-
if (ZEND_NUM_ARGS() > 0 && ZEND_SIZE_T_INT_OVFL(arg_len)) {
soap_server_fault("Server", "Input string is too long", NULL, NULL, NULL);
return;
@@ -1704,17 +1706,17 @@ PHP_METHOD(SoapServer, fault)
soapServicePtr service;
xmlCharEncodingHandlerPtr old_encoding;
- SOAP_SERVER_BEGIN_CODE();
- FETCH_THIS_SERVICE(service);
- old_encoding = SOAP_GLOBAL(encoding);
- SOAP_GLOBAL(encoding) = service->encoding;
-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|szs",
&code, &code_len, &string, &string_len, &actor, &actor_len,
&details,
&name, &name_len) == FAILURE) {
RETURN_THROWS();
}
+ SOAP_SERVER_BEGIN_CODE();
+ FETCH_THIS_SERVICE(service);
+ old_encoding = SOAP_GLOBAL(encoding);
+ SOAP_GLOBAL(encoding) = service->encoding;
+
soap_server_fault(code, string, actor, details, name);
SOAP_GLOBAL(encoding) = old_encoding;
@@ -1729,12 +1731,12 @@ PHP_METHOD(SoapServer, addSoapHeader)
zval *fault;
soapHeader **p;
- SOAP_SERVER_BEGIN_CODE();
-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O", &fault, soap_header_class_entry) ==
FAILURE) {
RETURN_THROWS();
}
+ SOAP_SERVER_BEGIN_CODE();
+
FETCH_THIS_SERVICE(service);
if (!service || !service->soap_headers_ptr) {