@@ -65,6 +65,8 @@ static xmlNodePtr serialize_parameter(sdlParamPtr param,zval *param_val,int inde
65
65
static xmlNodePtr serialize_zval (zval * val , sdlParamPtr param , char * paramName , int style , xmlNodePtr parent );
66
66
67
67
static void delete_service (void * service );
68
+ static void delete_hashtable (void * hashtable );
69
+ static void delete_argv (struct _soap_class * class );
68
70
69
71
static void soap_error_handler (int error_num , zend_string * error_filename , const uint32_t error_lineno , zend_string * message );
70
72
@@ -1012,11 +1014,9 @@ PHP_METHOD(SoapServer, setPersistence)
1012
1014
zend_argument_value_error (
1013
1015
1 , "must be either SOAP_PERSISTENCE_SESSION or SOAP_PERSISTENCE_REQUEST when the SOAP server is used in class mode"
1014
1016
);
1015
- RETURN_THROWS ();
1016
1017
}
1017
1018
} else {
1018
1019
zend_throw_error (NULL , "SoapServer::setPersistence(): Persistence cannot be set when the SOAP server is used in function mode" );
1019
- RETURN_THROWS ();
1020
1020
}
1021
1021
1022
1022
SOAP_SERVER_END_CODE ();
@@ -1043,6 +1043,8 @@ PHP_METHOD(SoapServer, setClass)
1043
1043
service -> type = SOAP_CLASS ;
1044
1044
service -> soap_class .ce = ce ;
1045
1045
1046
+ delete_argv (& service -> soap_class );
1047
+
1046
1048
service -> soap_class .persistence = SOAP_PERSISTENCE_REQUEST ;
1047
1049
service -> soap_class .argc = num_args ;
1048
1050
if (service -> soap_class .argc > 0 ) {
@@ -1074,6 +1076,7 @@ PHP_METHOD(SoapServer, setObject)
1074
1076
1075
1077
service -> type = SOAP_OBJECT ;
1076
1078
1079
+ zval_ptr_dtor (& service -> soap_object );
1077
1080
ZVAL_OBJ_COPY (& service -> soap_object , Z_OBJ_P (obj ));
1078
1081
1079
1082
SOAP_SERVER_END_CODE ();
@@ -1155,13 +1158,15 @@ PHP_METHOD(SoapServer, addFunction)
1155
1158
1156
1159
if (Z_TYPE_P (tmp_function ) != IS_STRING ) {
1157
1160
zend_argument_type_error (1 , "must contain only strings" );
1161
+ SOAP_SERVER_END_CODE ();
1158
1162
RETURN_THROWS ();
1159
1163
}
1160
1164
1161
1165
key = zend_string_tolower (Z_STR_P (tmp_function ));
1162
1166
1163
1167
if ((f = zend_hash_find_ptr (EG (function_table ), key )) == NULL ) {
1164
1168
zend_type_error ("SoapServer::addFunction(): Function \"%s\" not found" , Z_STRVAL_P (tmp_function ));
1169
+ SOAP_SERVER_END_CODE ();
1165
1170
RETURN_THROWS ();
1166
1171
}
1167
1172
@@ -1179,6 +1184,7 @@ PHP_METHOD(SoapServer, addFunction)
1179
1184
1180
1185
if ((f = zend_hash_find_ptr (EG (function_table ), key )) == NULL ) {
1181
1186
zend_argument_type_error (1 , "must be a valid function name, function \"%s\" not found" , Z_STRVAL_P (function_name ));
1187
+ SOAP_SERVER_END_CODE ();
1182
1188
RETURN_THROWS ();
1183
1189
}
1184
1190
if (service -> soap_functions .ft == NULL ) {
@@ -1199,11 +1205,9 @@ PHP_METHOD(SoapServer, addFunction)
1199
1205
service -> soap_functions .functions_all = TRUE;
1200
1206
} else {
1201
1207
zend_argument_value_error (1 , "must be SOAP_FUNCTIONS_ALL when an integer is passed" );
1202
- RETURN_THROWS ();
1203
1208
}
1204
1209
} else {
1205
1210
zend_argument_type_error (1 , "must be of type array|string|int, %s given" , zend_zval_value_name (function_name ));
1206
- RETURN_THROWS ();
1207
1211
}
1208
1212
1209
1213
SOAP_SERVER_END_CODE ();
@@ -1263,6 +1267,7 @@ PHP_METHOD(SoapServer, handle)
1263
1267
1264
1268
if (arg && ZEND_SIZE_T_INT_OVFL (arg_len )) {
1265
1269
soap_server_fault ("Server" , "Input string is too long" , NULL , NULL , NULL );
1270
+ SOAP_SERVER_END_CODE ();
1266
1271
return ;
1267
1272
}
1268
1273
@@ -1344,10 +1349,12 @@ PHP_METHOD(SoapServer, handle)
1344
1349
php_stream_filter_append (& SG (request_info ).request_body -> readfilters , zf );
1345
1350
} else {
1346
1351
php_error_docref (NULL , E_WARNING ,"Can't uncompress compressed request" );
1352
+ SOAP_SERVER_END_CODE ();
1347
1353
return ;
1348
1354
}
1349
1355
} else {
1350
1356
php_error_docref (NULL , E_WARNING ,"Request is compressed with unknown compression '%s'" ,Z_STRVAL_P (encoding ));
1357
+ SOAP_SERVER_END_CODE ();
1351
1358
return ;
1352
1359
}
1353
1360
}
@@ -1359,6 +1366,7 @@ PHP_METHOD(SoapServer, handle)
1359
1366
}
1360
1367
} else {
1361
1368
zval_ptr_dtor (& retval );
1369
+ SOAP_SERVER_END_CODE ();
1362
1370
return ;
1363
1371
}
1364
1372
} else {
@@ -1618,7 +1626,7 @@ PHP_METHOD(SoapServer, handle)
1618
1626
sapi_add_header ("Content-Type: text/xml; charset=utf-8" , sizeof ("Content-Type: text/xml; charset=utf-8" )- 1 , 1 );
1619
1627
}
1620
1628
1621
- if (zend_ini_long ("zlib.output_compression" , sizeof ( "zlib.output_compression" ), 0 )) {
1629
+ if (INI_INT ("zlib.output_compression" )) {
1622
1630
sapi_add_header ("Connection: close" , sizeof ("Connection: close" )- 1 , 1 );
1623
1631
} else {
1624
1632
snprintf (cont_len , sizeof (cont_len ), "Content-Length: %d" , size );
@@ -1720,6 +1728,7 @@ PHP_METHOD(SoapServer, addSoapHeader)
1720
1728
1721
1729
if (!service || !service -> soap_headers_ptr ) {
1722
1730
zend_throw_error (NULL , "SoapServer::addSoapHeader() may be called only during SOAP request processing" );
1731
+ SOAP_SERVER_END_CODE ();
1723
1732
RETURN_THROWS ();
1724
1733
}
1725
1734
@@ -1766,7 +1775,7 @@ static void soap_server_fault_ex(sdlFunctionPtr function, zval* fault, soapHeade
1766
1775
if (use_http_error_status ) {
1767
1776
sapi_add_header ("HTTP/1.1 500 Internal Server Error" , sizeof ("HTTP/1.1 500 Internal Server Error" )- 1 , 1 );
1768
1777
}
1769
- if (zend_ini_long ("zlib.output_compression" , sizeof ( "zlib.output_compression" ), 0 )) {
1778
+ if (INI_INT ("zlib.output_compression" )) {
1770
1779
sapi_add_header ("Connection: close" , sizeof ("Connection: close" )- 1 , 1 );
1771
1780
} else {
1772
1781
snprintf (cont_len , sizeof (cont_len ), "Content-Length: %d" , size );
@@ -4439,6 +4448,16 @@ static void type_to_string(sdlTypePtr type, smart_str *buf, int level) /* {{{ */
4439
4448
}
4440
4449
/* }}} */
4441
4450
4451
+ static void delete_argv (struct _soap_class * class )
4452
+ {
4453
+ if (class -> argc ) {
4454
+ for (int i = 0 ; i < class -> argc ; i ++ ) {
4455
+ zval_ptr_dtor (& class -> argv [i ]);
4456
+ }
4457
+ efree (class -> argv );
4458
+ }
4459
+ }
4460
+
4442
4461
static void delete_service (void * data ) /* {{{ */
4443
4462
{
4444
4463
soapServicePtr service = (soapServicePtr )data ;
@@ -4453,13 +4472,7 @@ static void delete_service(void *data) /* {{{ */
4453
4472
efree (service -> typemap );
4454
4473
}
4455
4474
4456
- if (service -> soap_class .argc ) {
4457
- int i ;
4458
- for (i = 0 ; i < service -> soap_class .argc ;i ++ ) {
4459
- zval_ptr_dtor (& service -> soap_class .argv [i ]);
4460
- }
4461
- efree (service -> soap_class .argv );
4462
- }
4475
+ delete_argv (& service -> soap_class );
4463
4476
4464
4477
if (service -> actor ) {
4465
4478
efree (service -> actor );
0 commit comments