[php-src] master: ext/soap: refactor parse_packet_soap()

Gina Peter Banyard <[email protected]>
Newsgroups gmane.comp.php.cvs.general
Message-ID <[email protected]>
Author: Gina Peter Banyard (Girgias)
Date: 2026-07-03T11:28:29+01:00

Commit: https://github.com/php/php-src/commit/db5845e3217ff6a7b5a1fcee49fcb2c35c2925a7
Raw diff: https://github.com/php/php-src/commit/db5845e3217ff6a7b5a1fcee49fcb2c35c2925a7.diff

ext/soap: refactor parse_packet_soap()

Use zend_string* rather than a pair and remove unused param

Changed paths:
  M  ext/soap/php_packet_soap.c
  M  ext/soap/php_packet_soap.h
  M  ext/soap/soap.c


Diff:

diff --git a/ext/soap/php_packet_soap.c b/ext/soap/php_packet_soap.c
index 006f9cca9c5b..2a2f94cb349a 100644
--- a/ext/soap/php_packet_soap.c
+++ b/ext/soap/php_packet_soap.c
@@ -39,7 +39,7 @@ static void master_to_zval_with_doc_cleanup(zval *ret, encodePtr encode, xmlNode
 }
 
 /* SOAP client calls this function to parse response from SOAP server */
-bool parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunctionPtr fn, char *fn_name, zval *return_value, zval *soap_headers)
+bool parse_packet_soap(zval *this_ptr, zend_string *buffer, sdlFunctionPtr fn, zval *return_value, zval *soap_headers)
 {
 	char* envelope_ns = NULL;
 	xmlDocPtr response;
@@ -52,12 +52,12 @@ bool parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunctio
 	ZVAL_NULL(return_value);
 
 	/* Response for one-way operation */
-	if (buffer_size == 0) {
+	if (ZSTR_LEN(buffer) == 0) {
 		return true;
 	}
 
 	/* Parse XML packet */
-	response = soap_xmlParseMemory(buffer, buffer_size);
+	response = soap_xmlParseMemory(ZSTR_VAL(buffer), ZSTR_LEN(buffer));
 
 	if (!response) {
 		add_soap_fault(this_ptr, "Client", "looks like we got no XML document", NULL, NULL, soap_lang_en);
diff --git a/ext/soap/php_packet_soap.h b/ext/soap/php_packet_soap.h
index 569b23949659..dc4b44176867 100644
--- a/ext/soap/php_packet_soap.h
+++ b/ext/soap/php_packet_soap.h
@@ -17,6 +17,6 @@
 #ifndef PHP_PACKET_SOAP_H
 #define PHP_PACKET_SOAP_H
 
-bool parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunctionPtr fn, char *fn_name, zval *return_value, zval *soap_headers);
+bool parse_packet_soap(zval *this_ptr, zend_string *buffer, sdlFunctionPtr fn, zval *return_value, zval *soap_headers);
 
 #endif
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index 8d9ad77d26e8..d8f72e0191aa 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -2447,7 +2447,7 @@ static void do_soap_call(zend_execute_data *execute_data,
 
 					encode_reset_ns();
 					zend_try {
-						ret = parse_packet_soap(this_ptr, Z_STRVAL(response), Z_STRLEN(response), fn, NULL, return_value, output_headers);
+						ret = parse_packet_soap(this_ptr, Z_STR(response), fn, return_value, output_headers);
 					} zend_catch {
 						parse_bailout = true;
 					} zend_end_try();
@@ -2501,7 +2501,7 @@ static void do_soap_call(zend_execute_data *execute_data,
 
 					encode_reset_ns();
 					zend_try {
-						ret = parse_packet_soap(this_ptr, Z_STRVAL(response), Z_STRLEN(response), NULL, NULL, return_value, output_headers);
+						ret = parse_packet_soap(this_ptr, Z_STR(response), NULL, return_value, output_headers);
 					} zend_catch {
 						parse_bailout = true;
 					} zend_end_try();
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.