1
0
mirror of https://github.com/php/php-src.git synced 2026-03-30 20:22:36 +02:00

Declare SoapServer::$service property

This commit is contained in:
Nikita Popov
2021-08-19 14:10:21 +02:00
parent c58c926034
commit bdf8b9ed2d
3 changed files with 23 additions and 15 deletions

View File

@@ -143,12 +143,15 @@ static void soap_error_handler(int error_num, zend_string *error_filename, const
#define FIND_TYPEMAP_PROPERTY(ss,tmp) (tmp = zend_hash_str_find(Z_OBJPROP_P(ss), "typemap", sizeof("typemap")-1))
#define FETCH_TYPEMAP_RES(ss,tmp) ss = (HashTable*) zend_fetch_resource_ex(tmp, "typemap", le_typemap)
#define Z_PARAM_NAME_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 0)
#define Z_PARAM_DATA_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 1)
#define Z_SERVER_SERVICE_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 0)
#define FETCH_THIS_SERVICE(ss) \
{ \
zval *tmp; \
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(ZEND_THIS),"service", sizeof("service")-1)) != NULL) { \
ss = (soapServicePtr)zend_fetch_resource_ex(tmp, "service", le_service); \
} else { \
zval *tmp = Z_SERVER_SERVICE_P(ZEND_THIS); \
ss = (soapServicePtr)zend_fetch_resource_ex(tmp, "service", le_service); \
if (!ss) { \
zend_throw_error(NULL, "Cannot fetch SoapServer object"); \
SOAP_SERVER_END_CODE(); \
RETURN_THROWS(); \
@@ -162,9 +165,6 @@ static zend_class_entry* soap_header_class_entry;
static zend_class_entry* soap_param_class_entry;
zend_class_entry* soap_var_class_entry;
#define Z_PARAM_NAME_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 0)
#define Z_PARAM_DATA_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 1)
ZEND_DECLARE_MODULE_GLOBALS(soap)
static void (*old_error_handler)(int, zend_string *, const uint32_t, zend_string *);
@@ -927,7 +927,7 @@ PHP_METHOD(SoapServer, __construct)
}
res = zend_register_resource(service, le_service);
add_property_resource(ZEND_THIS, "service", res);
ZVAL_RES(Z_SERVER_SERVICE_P(ZEND_THIS), res);
SOAP_SERVER_END_CODE();
}
@@ -1841,20 +1841,19 @@ static zend_never_inline ZEND_COLD void soap_real_error_handler(int error_num, z
zval fault_obj;
if (error_num & E_FATAL_ERRORS) {
char* code = SOAP_GLOBAL(error_code);
char *code = SOAP_GLOBAL(error_code);
zval *error_object = &SOAP_GLOBAL(error_object);
zend_string *buffer;
zval outbuf;
zval *tmp;
soapServicePtr service;
ZVAL_UNDEF(&outbuf);
if (code == NULL) {
code = "Server";
}
if (Z_OBJ(SOAP_GLOBAL(error_object)) &&
instanceof_function(Z_OBJCE(SOAP_GLOBAL(error_object)), soap_server_class_entry) &&
(tmp = zend_hash_str_find(Z_OBJPROP(SOAP_GLOBAL(error_object)), "service", sizeof("service")-1)) != NULL &&
(service = (soapServicePtr)zend_fetch_resource_ex(tmp, "service", le_service)) &&
if (Z_OBJ_P(error_object) &&
instanceof_function(Z_OBJCE_P(error_object), soap_server_class_entry) &&
(service = (soapServicePtr)zend_fetch_resource_ex(Z_SERVER_SERVICE_P(error_object), "service", le_service)) &&
!service->send_errors) {
buffer = zend_string_init("Internal Error", sizeof("Internal Error")-1, 0);
} else {

View File

@@ -40,6 +40,9 @@ class SoapVar
class SoapServer
{
/** @var resource */
public $service;
public function __construct(?string $wsdl, array $options = []) {}
/** @tentative-return-type */

View File

@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 6e48f3873213091cf629f9dc7f2c7285ffcf23eb */
* Stub hash: f1f7c9c948e33f0b48ff66ea3515dc995ee8f870 */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_use_soap_error_handler, 0, 0, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, enable, _IS_BOOL, 0, "true")
@@ -328,6 +328,12 @@ static zend_class_entry *register_class_SoapServer(void)
INIT_CLASS_ENTRY(ce, "SoapServer", class_SoapServer_methods);
class_entry = zend_register_internal_class_ex(&ce, NULL);
zval property_service_default_value;
ZVAL_NULL(&property_service_default_value);
zend_string *property_service_name = zend_string_init("service", sizeof("service") - 1, 1);
zend_declare_property_ex(class_entry, property_service_name, &property_service_default_value, ZEND_ACC_PUBLIC, NULL);
zend_string_release(property_service_name);
return class_entry;
}