@@ -157,6 +157,15 @@ static void soap_error_handler(int error_num, zend_string *error_filename, uint3
157157#define Z_FAULT_NAME_P (zv ) php_soap_deref(OBJ_PROP_NUM(Z_OBJ_P(zv), FAULT_PROP_START_OFFSET + 5))
158158#define Z_FAULT_HEADERFAULT_P (zv ) php_soap_deref(OBJ_PROP_NUM(Z_OBJ_P(zv), FAULT_PROP_START_OFFSET + 6))
159159
160+ #define FETCH_THIS_SERVICE_NO_BAILOUT (ss ) \
161+ { \
162+ ss = soap_server_object_fetch(Z_OBJ_P(ZEND_THIS))->service; \
163+ if (!ss) { \
164+ zend_throw_error(NULL, "Cannot fetch SoapServer object"); \
165+ RETURN_THROWS(); \
166+ } \
167+ }
168+
160169#define FETCH_THIS_SERVICE (ss ) \
161170 { \
162171 ss = soap_server_object_fetch(Z_OBJ_P(ZEND_THIS))->service; \
@@ -1009,15 +1018,12 @@ PHP_METHOD(SoapServer, setPersistence)
10091018 RETURN_THROWS ();
10101019 }
10111020
1012- SOAP_SERVER_BEGIN_CODE ();
1013-
1014- FETCH_THIS_SERVICE (service );
1021+ FETCH_THIS_SERVICE_NO_BAILOUT (service );
10151022
10161023 if (service -> type == SOAP_CLASS ) {
10171024 if (value == SOAP_PERSISTENCE_SESSION ||
10181025 value == SOAP_PERSISTENCE_REQUEST ) {
10191026 if (value == SOAP_PERSISTENCE_SESSION && !zend_hash_str_exists (& module_registry , "session" , sizeof ("session" )- 1 )) {
1020- SOAP_SERVER_END_CODE ();
10211027 zend_throw_error (NULL , "SoapServer::setPersistence(): Session persistence cannot be enabled because the session module is not enabled" );
10221028 RETURN_THROWS ();
10231029 }
@@ -1031,8 +1037,6 @@ PHP_METHOD(SoapServer, setPersistence)
10311037 } else {
10321038 zend_throw_error (NULL , "SoapServer::setPersistence(): Persistence cannot be set when the SOAP server is used in function mode" );
10331039 }
1034-
1035- SOAP_SERVER_END_CODE ();
10361040}
10371041/* }}} */
10381042
0 commit comments