Skip to content

Commit db5845e

Browse files
committed
ext/soap: refactor parse_packet_soap()
Use zend_string* rather than a pair and remove unused param
1 parent 14fb869 commit db5845e

3 files changed

Lines changed: 6 additions & 6 deletions

File tree

ext/soap/php_packet_soap.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static void master_to_zval_with_doc_cleanup(zval *ret, encodePtr encode, xmlNode
3939
}
4040

4141
/* SOAP client calls this function to parse response from SOAP server */
42-
bool parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunctionPtr fn, char *fn_name, zval *return_value, zval *soap_headers)
42+
bool parse_packet_soap(zval *this_ptr, zend_string *buffer, sdlFunctionPtr fn, zval *return_value, zval *soap_headers)
4343
{
4444
char* envelope_ns = NULL;
4545
xmlDocPtr response;
@@ -52,12 +52,12 @@ bool parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunctio
5252
ZVAL_NULL(return_value);
5353

5454
/* Response for one-way operation */
55-
if (buffer_size == 0) {
55+
if (ZSTR_LEN(buffer) == 0) {
5656
return true;
5757
}
5858

5959
/* Parse XML packet */
60-
response = soap_xmlParseMemory(buffer, buffer_size);
60+
response = soap_xmlParseMemory(ZSTR_VAL(buffer), ZSTR_LEN(buffer));
6161

6262
if (!response) {
6363
add_soap_fault(this_ptr, "Client", "looks like we got no XML document", NULL, NULL, soap_lang_en);

ext/soap/php_packet_soap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
#ifndef PHP_PACKET_SOAP_H
1818
#define PHP_PACKET_SOAP_H
1919

20-
bool parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunctionPtr fn, char *fn_name, zval *return_value, zval *soap_headers);
20+
bool parse_packet_soap(zval *this_ptr, zend_string *buffer, sdlFunctionPtr fn, zval *return_value, zval *soap_headers);
2121

2222
#endif

ext/soap/soap.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2447,7 +2447,7 @@ static void do_soap_call(zend_execute_data *execute_data,
24472447

24482448
encode_reset_ns();
24492449
zend_try {
2450-
ret = parse_packet_soap(this_ptr, Z_STRVAL(response), Z_STRLEN(response), fn, NULL, return_value, output_headers);
2450+
ret = parse_packet_soap(this_ptr, Z_STR(response), fn, return_value, output_headers);
24512451
} zend_catch {
24522452
parse_bailout = true;
24532453
} zend_end_try();
@@ -2501,7 +2501,7 @@ static void do_soap_call(zend_execute_data *execute_data,
25012501

25022502
encode_reset_ns();
25032503
zend_try {
2504-
ret = parse_packet_soap(this_ptr, Z_STRVAL(response), Z_STRLEN(response), NULL, NULL, return_value, output_headers);
2504+
ret = parse_packet_soap(this_ptr, Z_STR(response), NULL, return_value, output_headers);
25052505
} zend_catch {
25062506
parse_bailout = true;
25072507
} zend_end_try();

0 commit comments

Comments
 (0)