@@ -66,6 +66,7 @@ static xmlNodePtr serialize_zval(zval *val, sdlParamPtr param, char *paramName,
66
66
static void delete_service (void * service );
67
67
static void delete_url (void * handle );
68
68
static void delete_hashtable (void * hashtable );
69
+ static void delete_argv (struct _soap_class * class );
69
70
70
71
static void soap_error_handler (int error_num , zend_string * error_filename , const uint32_t error_lineno , zend_string * message );
71
72
@@ -899,11 +900,9 @@ PHP_METHOD(SoapServer, setPersistence)
899
900
zend_argument_value_error (
900
901
1 , "must be either SOAP_PERSISTENCE_SESSION or SOAP_PERSISTENCE_REQUEST when the SOAP server is used in class mode"
901
902
);
902
- RETURN_THROWS ();
903
903
}
904
904
} else {
905
905
zend_throw_error (NULL , "SoapServer::setPersistence(): Persistence cannot be set when the SOAP server is used in function mode" );
906
- RETURN_THROWS ();
907
906
}
908
907
909
908
SOAP_SERVER_END_CODE ();
@@ -930,6 +929,8 @@ PHP_METHOD(SoapServer, setClass)
930
929
service -> type = SOAP_CLASS ;
931
930
service -> soap_class .ce = ce ;
932
931
932
+ delete_argv (& service -> soap_class );
933
+
933
934
service -> soap_class .persistence = SOAP_PERSISTENCE_REQUEST ;
934
935
service -> soap_class .argc = num_args ;
935
936
if (service -> soap_class .argc > 0 ) {
@@ -961,6 +962,7 @@ PHP_METHOD(SoapServer, setObject)
961
962
962
963
service -> type = SOAP_OBJECT ;
963
964
965
+ zval_ptr_dtor (& service -> soap_object );
964
966
ZVAL_OBJ_COPY (& service -> soap_object , Z_OBJ_P (obj ));
965
967
966
968
SOAP_SERVER_END_CODE ();
@@ -1042,13 +1044,15 @@ PHP_METHOD(SoapServer, addFunction)
1042
1044
1043
1045
if (Z_TYPE_P (tmp_function ) != IS_STRING ) {
1044
1046
zend_argument_type_error (1 , "must contain only strings" );
1047
+ SOAP_SERVER_END_CODE ();
1045
1048
RETURN_THROWS ();
1046
1049
}
1047
1050
1048
1051
key = zend_string_tolower (Z_STR_P (tmp_function ));
1049
1052
1050
1053
if ((f = zend_hash_find_ptr (EG (function_table ), key )) == NULL ) {
1051
1054
zend_type_error ("SoapServer::addFunction(): Function \"%s\" not found" , Z_STRVAL_P (tmp_function ));
1055
+ SOAP_SERVER_END_CODE ();
1052
1056
RETURN_THROWS ();
1053
1057
}
1054
1058
@@ -1066,6 +1070,7 @@ PHP_METHOD(SoapServer, addFunction)
1066
1070
1067
1071
if ((f = zend_hash_find_ptr (EG (function_table ), key )) == NULL ) {
1068
1072
zend_argument_type_error (1 , "must be a valid function name, function \"%s\" not found" , Z_STRVAL_P (function_name ));
1073
+ SOAP_SERVER_END_CODE ();
1069
1074
RETURN_THROWS ();
1070
1075
}
1071
1076
if (service -> soap_functions .ft == NULL ) {
@@ -1086,11 +1091,9 @@ PHP_METHOD(SoapServer, addFunction)
1086
1091
service -> soap_functions .functions_all = TRUE;
1087
1092
} else {
1088
1093
zend_argument_value_error (1 , "must be SOAP_FUNCTIONS_ALL when an integer is passed" );
1089
- RETURN_THROWS ();
1090
1094
}
1091
1095
} else {
1092
1096
zend_argument_type_error (1 , "must be of type array|string|int, %s given" , zend_zval_value_name (function_name ));
1093
- RETURN_THROWS ();
1094
1097
}
1095
1098
1096
1099
SOAP_SERVER_END_CODE ();
@@ -1150,6 +1153,7 @@ PHP_METHOD(SoapServer, handle)
1150
1153
1151
1154
if (arg && ZEND_SIZE_T_INT_OVFL (arg_len )) {
1152
1155
soap_server_fault ("Server" , "Input string is too long" , NULL , NULL , NULL );
1156
+ SOAP_SERVER_END_CODE ();
1153
1157
return ;
1154
1158
}
1155
1159
@@ -1231,10 +1235,12 @@ PHP_METHOD(SoapServer, handle)
1231
1235
php_stream_filter_append (& SG (request_info ).request_body -> readfilters , zf );
1232
1236
} else {
1233
1237
php_error_docref (NULL , E_WARNING ,"Can't uncompress compressed request" );
1238
+ SOAP_SERVER_END_CODE ();
1234
1239
return ;
1235
1240
}
1236
1241
} else {
1237
1242
php_error_docref (NULL , E_WARNING ,"Request is compressed with unknown compression '%s'" ,Z_STRVAL_P (encoding ));
1243
+ SOAP_SERVER_END_CODE ();
1238
1244
return ;
1239
1245
}
1240
1246
}
@@ -1246,6 +1252,7 @@ PHP_METHOD(SoapServer, handle)
1246
1252
}
1247
1253
} else {
1248
1254
zval_ptr_dtor (& retval );
1255
+ SOAP_SERVER_END_CODE ();
1249
1256
return ;
1250
1257
}
1251
1258
} else {
@@ -1520,7 +1527,7 @@ PHP_METHOD(SoapServer, handle)
1520
1527
sapi_add_header ("Content-Type: text/xml; charset=utf-8" , sizeof ("Content-Type: text/xml; charset=utf-8" )- 1 , 1 );
1521
1528
}
1522
1529
1523
- if (zend_ini_long ("zlib.output_compression" , sizeof ( "zlib.output_compression" ), 0 )) {
1530
+ if (INI_INT ("zlib.output_compression" )) {
1524
1531
sapi_add_header ("Connection: close" , sizeof ("Connection: close" )- 1 , 1 );
1525
1532
} else {
1526
1533
snprintf (cont_len , sizeof (cont_len ), "Content-Length: %d" , size );
@@ -1622,6 +1629,7 @@ PHP_METHOD(SoapServer, addSoapHeader)
1622
1629
1623
1630
if (!service || !service -> soap_headers_ptr ) {
1624
1631
zend_throw_error (NULL , "SoapServer::addSoapHeader() may be called only during SOAP request processing" );
1632
+ SOAP_SERVER_END_CODE ();
1625
1633
RETURN_THROWS ();
1626
1634
}
1627
1635
@@ -1668,7 +1676,7 @@ static void soap_server_fault_ex(sdlFunctionPtr function, zval* fault, soapHeade
1668
1676
if (use_http_error_status ) {
1669
1677
sapi_add_header ("HTTP/1.1 500 Internal Server Error" , sizeof ("HTTP/1.1 500 Internal Server Error" )- 1 , 1 );
1670
1678
}
1671
- if (zend_ini_long ("zlib.output_compression" , sizeof ( "zlib.output_compression" ), 0 )) {
1679
+ if (INI_INT ("zlib.output_compression" )) {
1672
1680
sapi_add_header ("Connection: close" , sizeof ("Connection: close" )- 1 , 1 );
1673
1681
} else {
1674
1682
snprintf (cont_len , sizeof (cont_len ), "Content-Length: %d" , size );
@@ -4342,6 +4350,16 @@ static void delete_url(void *handle) /* {{{ */
4342
4350
}
4343
4351
/* }}} */
4344
4352
4353
+ static void delete_argv (struct _soap_class * class )
4354
+ {
4355
+ if (class -> argc ) {
4356
+ for (int i = 0 ; i < class -> argc ; i ++ ) {
4357
+ zval_ptr_dtor (& class -> argv [i ]);
4358
+ }
4359
+ efree (class -> argv );
4360
+ }
4361
+ }
4362
+
4345
4363
static void delete_service (void * data ) /* {{{ */
4346
4364
{
4347
4365
soapServicePtr service = (soapServicePtr )data ;
@@ -4356,13 +4374,7 @@ static void delete_service(void *data) /* {{{ */
4356
4374
efree (service -> typemap );
4357
4375
}
4358
4376
4359
- if (service -> soap_class .argc ) {
4360
- int i ;
4361
- for (i = 0 ; i < service -> soap_class .argc ;i ++ ) {
4362
- zval_ptr_dtor (& service -> soap_class .argv [i ]);
4363
- }
4364
- efree (service -> soap_class .argv );
4365
- }
4377
+ delete_argv (& service -> soap_class );
4366
4378
4367
4379
if (service -> actor ) {
4368
4380
efree (service -> actor );
0 commit comments