Commit 8c008042cb6 for php.net

commit 8c008042cb691d556587875d7d5e86f3abbc35fa
Author: Gina Peter Banyard <girgias@php.net>
Date:   Thu Jul 2 23:26:28 2026 +0100

    ext/soap: use bool type instead of int type in php_http.c

diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c
index 2594be75fe1..5d7485af883 100644
--- a/ext/soap/php_http.c
+++ b/ext/soap/php_http.c
@@ -20,14 +20,14 @@

 static char *get_http_header_value_nodup(char *headers, char *type, size_t *len);
 static char *get_http_header_value(char *headers, char *type);
-static zend_string *get_http_body(php_stream *socketd, int close, char *headers);
+static zend_string *get_http_body(php_stream *socketd, bool close, char *headers);
 static zend_string *get_http_headers(php_stream *socketd);

 #define smart_str_append_const(str, const) \
 	smart_str_appendl(str,const,sizeof(const)-1)

 /* Proxy HTTP Authentication */
-int proxy_authentication(zval* this_ptr, smart_str* soap_headers)
+bool proxy_authentication(zval* this_ptr, smart_str* soap_headers)
 {
 	zval *login = Z_CLIENT_PROXY_LOGIN_P(this_ptr);
 	if (Z_TYPE_P(login) == IS_STRING) {
@@ -44,15 +44,15 @@ int proxy_authentication(zval* this_ptr, smart_str* soap_headers)
 		smart_str_append_const(soap_headers, "Proxy-Authorization: Basic ");
 		smart_str_append(soap_headers, buf);
 		smart_str_append_const(soap_headers, "\r\n");
-		zend_string_release_ex(buf, 0);
+		zend_string_release_ex(buf, false);
 		smart_str_free(&auth);
-		return 1;
+		return true;
 	}
-	return 0;
+	return false;
 }

 /* HTTP Authentication */
-int basic_authentication(zval* this_ptr, smart_str* soap_headers)
+bool basic_authentication(zval* this_ptr, smart_str* soap_headers)
 {
 	zval *login = Z_CLIENT_LOGIN_P(this_ptr);
 	zval *use_digest = Z_CLIENT_USE_DIGEST_P(this_ptr);
@@ -70,11 +70,11 @@ int basic_authentication(zval* this_ptr, smart_str* soap_headers)
 		smart_str_append_const(soap_headers, "Authorization: Basic ");
 		smart_str_append(soap_headers, buf);
 		smart_str_append_const(soap_headers, "\r\n");
-		zend_string_release_ex(buf, 0);
+		zend_string_release_ex(buf, false);
 		smart_str_free(&auth);
-		return 1;
+		return true;
 	}
-	return 0;
+	return false;
 }

 static void http_context_add_header(const char *s,
@@ -161,7 +161,7 @@ void http_context_headers(php_stream_context* context,
 	}
 }

-static php_stream* http_connect(zval* this_ptr, php_uri *uri, int use_ssl, php_stream_context *context, int *use_proxy)
+static php_stream* http_connect(zval* this_ptr, php_uri *uri, bool use_ssl, php_stream_context *context, int *use_proxy)
 {
 	php_stream *stream;
 	zval *tmp, ssl_proxy_peer_name;
@@ -334,7 +334,7 @@ static bool in_domain(const zend_string *host, const zend_string *domain)
 	}
 }

-int make_http_soap_request(
+bool make_http_soap_request(
 	zval *this_ptr, zend_string *buf, zend_string *location, char *soapaction,
 	int soap_version, zend_string *uri_parser_class, zval *return_value
 ) {
@@ -346,14 +346,13 @@ int make_http_soap_request(
 	php_stream *stream;
 	zval *tmp;
 	int use_proxy = 0;
-	int use_ssl;
 	zend_string *http_body;
 	char *content_type, *http_version, *cookie_itt;
 	size_t cookie_len;
-	int http_close;
+	bool http_close;
 	zend_string *http_headers;
 	char *connection;
-	int http_1_1;
+	bool http_1_1;
 	int http_status;
 	int content_type_xml = 0;
 	zend_long redirect_max = 20;
@@ -366,7 +365,7 @@ int make_http_soap_request(
 	bool has_cookies = false;

 	if (this_ptr == NULL || Z_TYPE_P(this_ptr) != IS_OBJECT) {
-		return FALSE;
+		return false;
 	}

 	request = buf;
@@ -412,7 +411,7 @@ int make_http_soap_request(
 					zend_string_release_ex(request, 0);
 				}
 				smart_str_free(&soap_headers_z);
-				return FALSE;
+				return false;
 			}
 	  }
 	}
@@ -432,7 +431,7 @@ int make_http_soap_request(
 		const php_uri_parser *uri_parser = php_uri_get_parser(uri_parser_class);
 		if (uri_parser == NULL) {
 			zend_argument_value_error(6, "must be a valid URI parser name");
-			return FALSE;
+			return false;
 		}
 		uri = php_uri_parse_to_struct(uri_parser, ZSTR_VAL(location), ZSTR_LEN(location), PHP_URI_COMPONENT_READ_MODE_RAW, true);
 	}
@@ -461,12 +460,12 @@ int make_http_soap_request(
 		add_soap_fault(this_ptr, "HTTP", "Unable to parse URL", NULL, NULL, soap_lang_en);
 		smart_str_free(&soap_headers_z);
 		efree(http_msg);
-		return FALSE;
+		return false;
 	}

-	use_ssl = 0;
+	bool use_ssl = false;
 	if (uri->scheme != NULL && zend_string_equals_literal(uri->scheme, "https")) {
-		use_ssl = 1;
+		use_ssl = true;
 	} else if (uri->scheme == NULL || !zend_string_equals_literal(uri->scheme, "http")) {
 		php_uri_struct_free(uri);
 		if (request != buf) {
@@ -475,7 +474,7 @@ int make_http_soap_request(
 		add_soap_fault(this_ptr, "HTTP", "Unknown protocol. Only http and https are allowed.", NULL, NULL, soap_lang_en);
 		smart_str_free(&soap_headers_z);
 		efree(http_msg);
-		return FALSE;
+		return false;
 	}

 	old_allow_url_fopen = PG(allow_url_fopen);
@@ -489,7 +488,7 @@ int make_http_soap_request(
 		PG(allow_url_fopen) = old_allow_url_fopen;
 		smart_str_free(&soap_headers_z);
 		efree(http_msg);
-		return FALSE;
+		return false;
 	}

 	if (uri->port == 0) {
@@ -542,7 +541,7 @@ int make_http_soap_request(
 			PG(allow_url_fopen) = old_allow_url_fopen;
 			smart_str_free(&soap_headers_z);
 			efree(http_msg);
-			return FALSE;
+			return false;
 		}
 	}
 	PG(allow_url_fopen) = old_allow_url_fopen;
@@ -565,9 +564,9 @@ int make_http_soap_request(
 		    (tmp = php_stream_context_get_option(context, "http", "protocol_version")) != NULL &&
 		    Z_TYPE_P(tmp) == IS_DOUBLE &&
 		    Z_DVAL_P(tmp) == 1.0) {
-			http_1_1 = 0;
+			http_1_1 = false;
 		} else {
-			http_1_1 = 1;
+			http_1_1 = true;
 		}

 		smart_str_append_const(&soap_headers, "POST ");
@@ -694,7 +693,7 @@ int make_http_soap_request(
 					smart_str_free(&soap_headers_z);
 					smart_str_free(&soap_headers);
 					efree(http_msg);
-					return FALSE;
+					return false;
 				}

 				php_hash_bin2hex(cnonce, nonce, sizeof(nonce));
@@ -912,14 +911,14 @@ int make_http_soap_request(
 			add_soap_fault(this_ptr, "HTTP", "Failed Sending HTTP SOAP request", NULL, NULL, soap_lang_en);
 			smart_str_free(&soap_headers_z);
 			efree(http_msg);
-			return FALSE;
+			return false;
 		}
 		smart_str_free(&soap_headers);
 	} else {
 		add_soap_fault(this_ptr, "HTTP", "Failed to create stream??", NULL, NULL, soap_lang_en);
 		smart_str_free(&soap_headers_z);
 		efree(http_msg);
-		return FALSE;
+		return false;
 	}

 	http_headers = NULL;
@@ -936,7 +935,7 @@ int make_http_soap_request(
 				add_soap_fault(this_ptr, "HTTP", "Error Fetching http headers", NULL, NULL, soap_lang_en);
 				smart_str_free(&soap_headers_z);
 				efree(http_msg);
-				return FALSE;
+				return false;
 			}

 			if (client_trace) {
@@ -945,14 +944,14 @@ int make_http_soap_request(
 			}

 			/* Check to see what HTTP status was sent */
-			http_1_1 = 0;
+			http_1_1 = false;
 			http_status = 0;
 			http_version = get_http_header_value(ZSTR_VAL(http_headers), "HTTP/");
 			if (http_version) {
 				char *tmp;

 				if (!strncmp(http_version,"1.1", 3)) {
-					http_1_1 = 1;
+					http_1_1 = true;
 				}

 				tmp = strstr(http_version," ");
@@ -1069,41 +1068,41 @@ int make_http_soap_request(

 	/* See if the server requested a close */
 	if (http_1_1) {
-		http_close = FALSE;
+		http_close = false;
 		if (use_proxy && !use_ssl) {
 			connection = get_http_header_value(ZSTR_VAL(http_headers), "Proxy-Connection:");
 			if (connection) {
 				if (strncasecmp(connection, "close", sizeof("close")-1) == 0) {
-					http_close = TRUE;
+					http_close = true;
 				}
 				efree(connection);
 			}
 		}
-		if (http_close == FALSE) {
+		if (http_close == false) {
 			connection = get_http_header_value(ZSTR_VAL(http_headers), "Connection:");
 			if (connection) {
 				if (strncasecmp(connection, "close", sizeof("close")-1) == 0) {
-					http_close = TRUE;
+					http_close = true;
 				}
 				efree(connection);
 			}
 		}
 	} else {
-		http_close = TRUE;
+		http_close = true;
 		if (use_proxy && !use_ssl) {
 			connection = get_http_header_value(ZSTR_VAL(http_headers), "Proxy-Connection:");
 			if (connection) {
 				if (strncasecmp(connection, "Keep-Alive", sizeof("Keep-Alive")-1) == 0) {
-					http_close = FALSE;
+					http_close = false;
 				}
 				efree(connection);
 			}
 		}
-		if (http_close == TRUE) {
+		if (http_close == true) {
 			connection = get_http_header_value(ZSTR_VAL(http_headers), "Connection:");
 			if (connection) {
 				if (strncasecmp(connection, "Keep-Alive", sizeof("Keep-Alive")-1) == 0) {
-					http_close = FALSE;
+					http_close = false;
 				}
 				efree(connection);
 			}
@@ -1125,7 +1124,7 @@ int make_http_soap_request(
 			efree(http_msg);
 		}
 		smart_str_free(&soap_headers_z);
-		return FALSE;
+		return false;
 	}

 	if (request != buf) {
@@ -1148,7 +1147,7 @@ int make_http_soap_request(
 			if (uri_parser == NULL) {
 				efree(loc);
 				zend_argument_value_error(6, "must be a valid URI parser name");
-				return FALSE;
+				return false;
 			}

 			php_uri *new_uri = php_uri_parse_to_struct(uri_parser, loc, strlen(loc), PHP_URI_COMPONENT_READ_MODE_RAW, true);
@@ -1185,7 +1184,7 @@ int make_http_soap_request(
 					add_soap_fault(this_ptr, "HTTP", "Redirection limit reached, aborting", NULL, NULL, soap_lang_en);
 					smart_str_free(&soap_headers_z);
 					efree(http_msg);
-					return FALSE;
+					return false;
 				}

 				goto try_again;
@@ -1288,7 +1287,7 @@ int make_http_soap_request(
 				efree(content_type);
 				zend_string_release_ex(http_headers, 0);
 				efree(http_body);
-				return FALSE;
+				return false;
 			}
 */
 		}
@@ -1319,7 +1318,7 @@ int make_http_soap_request(
 				efree(http_msg);
 			}
 			add_soap_fault(this_ptr, "HTTP", "Unknown Content-Encoding", NULL, NULL, soap_lang_en);
-			return FALSE;
+			return false;
 		}
 		zend_call_known_function(decompression_fn, NULL, NULL, &retval, 1, params, NULL);
 		if (Z_TYPE(retval) == IS_STRING) {
@@ -1334,7 +1333,7 @@ int make_http_soap_request(
 			if (http_msg) {
 				efree(http_msg);
 			}
-			return FALSE;
+			return false;
 		}
 		efree(content_encoding);
 	} else {
@@ -1366,7 +1365,7 @@ int make_http_soap_request(
 			ZVAL_UNDEF(return_value);
 			add_soap_fault(this_ptr, "HTTP", http_msg, NULL, NULL, soap_lang_en);
 			efree(http_msg);
-			return FALSE;
+			return false;
 		}
 	}

@@ -1374,7 +1373,7 @@ int make_http_soap_request(
 		efree(http_msg);
 	}

-	return TRUE;
+	return true;
 }

 static char *get_http_header_value_nodup(char *headers, char *type, size_t *len)
@@ -1444,22 +1443,27 @@ static char *get_http_header_value(char *headers, char *type)
 	return NULL;
 }

-static zend_string* get_http_body(php_stream *stream, int close, char *headers)
+static zend_string* get_http_body(php_stream *stream, bool close, char *headers)
 {
 	zend_string *http_buf = NULL;
 	char *header;
-	int header_close = close, header_chunked = 0, header_length = 0, http_buf_size = 0;
+	bool header_close = close, header_chunked = false;
+	int header_length = 0, http_buf_size = 0;

 	if (!close) {
 		header = get_http_header_value(headers, "Connection:");
 		if (header) {
-			if(!strncasecmp(header, "close", sizeof("close")-1)) header_close = 1;
+			if (!strncasecmp(header, "close", sizeof("close")-1)) {
+				header_close = true;
+			}
 			efree(header);
 		}
 	}
 	header = get_http_header_value(headers, "Transfer-Encoding:");
 	if (header) {
-		if(!strncasecmp(header, "chunked", sizeof("chunked")-1)) header_chunked = 1;
+		if (!strncasecmp(header, "chunked", sizeof("chunked")-1)) {
+			header_chunked = true;
+		}
 		efree(header);
 	}
 	header = get_http_header_value(headers, "Content-Length:");
@@ -1473,9 +1477,8 @@ static zend_string* get_http_body(php_stream *stream, int close, char *headers)
 	}

 	if (header_chunked) {
-		char ch, done, headerbuf[8192];
-
-		done = FALSE;
+		char ch, headerbuf[8192];
+		bool done = false;

 		while (!done) {
 			int buf_size = 0;
@@ -1502,7 +1505,7 @@ static zend_string* get_http_body(php_stream *stream, int close, char *headers)
 						ssize_t len_read = php_stream_read(stream, http_buf->val + http_buf_size, buf_size - len_size);
 						if (len_read <= 0) {
 							/* Error or EOF */
-							done = TRUE;
+							done = true;
 						  break;
 						}
 						len_size += len_read;
@@ -1530,7 +1533,7 @@ static zend_string* get_http_body(php_stream *stream, int close, char *headers)
 				return NULL;
 			}
 			if (buf_size == 0) {
-				done = TRUE;
+				done = true;
 			}
 		}

diff --git a/ext/soap/php_http.h b/ext/soap/php_http.h
index a01ea35f984..4f13b79f116 100644
--- a/ext/soap/php_http.h
+++ b/ext/soap/php_http.h
@@ -17,13 +17,13 @@
 #ifndef PHP_HTTP_H
 #define PHP_HTTP_H

-int make_http_soap_request(
+bool make_http_soap_request(
 	zval *this_ptr, zend_string *buf, zend_string *location, char *soapaction,
 	int soap_version, zend_string *uri_parser_class, zval *return_value
 );

-int proxy_authentication(zval* this_ptr, smart_str* soap_headers);
-int basic_authentication(zval* this_ptr, smart_str* soap_headers);
+bool proxy_authentication(zval* this_ptr, smart_str* soap_headers);
+bool basic_authentication(zval* this_ptr, smart_str* soap_headers);
 void http_context_headers(php_stream_context* context,
                           bool has_authorization,
                           bool has_proxy_authorization,