Commit 395d0186c1e for php.net

commit 395d0186c1efa0759e068fad1407f2353caa1af4
Author: Gina Peter Banyard <girgias@php.net>
Date:   Mon Jul 27 20:08:48 2026 +0100

    sapi: use zend_result type for return types when possible

diff --git a/main/SAPI.c b/main/SAPI.c
index 291b0de75cd..31cf5da18a1 100644
--- a/main/SAPI.c
+++ b/main/SAPI.c
@@ -646,7 +646,7 @@ static void sapi_header_add_op(sapi_header_op_enum op, sapi_header_struct *sapi_
 	}
 }

-SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg)
+SAPI_API zend_result sapi_header_op(sapi_header_op_enum op, void *arg)
 {
 	sapi_header_struct sapi_header;
 	char *colon_offset;
@@ -830,10 +830,10 @@ SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg)
 }


-SAPI_API int sapi_send_headers(void)
+SAPI_API zend_result sapi_send_headers(void)
 {
 	int retval;
-	int ret = FAILURE;
+	zend_result ret = FAILURE;

 	if (SG(headers_sent) || SG(request_info).no_headers) {
 		return SUCCESS;
@@ -919,7 +919,7 @@ SAPI_API int sapi_send_headers(void)
 }


-SAPI_API int sapi_register_post_entries(const sapi_post_entry *post_entries)
+SAPI_API zend_result sapi_register_post_entries(const sapi_post_entry *post_entries)
 {
 	const sapi_post_entry *p=post_entries;

@@ -933,16 +933,15 @@ SAPI_API int sapi_register_post_entries(const sapi_post_entry *post_entries)
 }


-SAPI_API int sapi_register_post_entry(const sapi_post_entry *post_entry)
+SAPI_API zend_result sapi_register_post_entry(const sapi_post_entry *post_entry)
 {
-	int ret;
 	zend_string *key;
 	if (SG(sapi_started) && EG(current_execute_data)) {
 		return FAILURE;
 	}
 	key = zend_string_init(post_entry->content_type, post_entry->content_type_len, 1);
 	GC_MAKE_PERSISTENT_LOCAL(key);
-	ret = zend_hash_add_mem(&SG(known_post_content_types), key,
+	zend_result ret = zend_hash_add_mem(&SG(known_post_content_types), key,
 			(void *) post_entry, sizeof(sapi_post_entry)) ? SUCCESS : FAILURE;
 	zend_string_release_ex(key, 1);
 	return ret;
@@ -958,7 +957,7 @@ SAPI_API void sapi_unregister_post_entry(const sapi_post_entry *post_entry)
 }


-SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(void))
+SAPI_API zend_result sapi_register_default_post_reader(void (*default_post_reader)(void))
 {
 	if (SG(sapi_started) && EG(current_execute_data)) {
 		return FAILURE;
@@ -968,7 +967,7 @@ SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(void)
 }


-SAPI_API int sapi_register_treat_data(void (*treat_data)(int arg, char *str, zval *destArray))
+SAPI_API zend_result sapi_register_treat_data(void (*treat_data)(int arg, char *str, zval *destArray))
 {
 	if (SG(sapi_started) && EG(current_execute_data)) {
 		return FAILURE;
@@ -977,7 +976,7 @@ SAPI_API int sapi_register_treat_data(void (*treat_data)(int arg, char *str, zva
 	return SUCCESS;
 }

-SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, const char *var, char **val, size_t val_len, size_t *new_val_len), unsigned int (*input_filter_init)(void))
+SAPI_API zend_result sapi_register_input_filter(unsigned int (*input_filter)(int arg, const char *var, char **val, size_t val_len, size_t *new_val_len), unsigned int (*input_filter_init)(void))
 {
 	if (SG(sapi_started) && EG(current_execute_data)) {
 		return FAILURE;
@@ -987,7 +986,7 @@ SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, co
 	return SUCCESS;
 }

-SAPI_API int sapi_flush(void)
+SAPI_API zend_result sapi_flush(void)
 {
 	if (sapi_module.flush) {
 		sapi_module.flush(SG(server_context));
diff --git a/main/SAPI.h b/main/SAPI.h
index 9536ced064d..29532a01933 100644
--- a/main/SAPI.h
+++ b/main/SAPI.h
@@ -198,25 +198,25 @@ typedef enum {					/* Parameter: 			*/
 } sapi_header_op_enum;

 BEGIN_EXTERN_C()
-SAPI_API int sapi_header_op(sapi_header_op_enum op, void *arg);
+SAPI_API zend_result sapi_header_op(sapi_header_op_enum op, void *arg);

 SAPI_API int sapi_add_header_ex(const char *header_line, size_t header_line_len, bool duplicate, bool replace);
 #define sapi_add_header(a, b, c) sapi_add_header_ex((a),(b),(c),1)


-SAPI_API int sapi_send_headers(void);
+SAPI_API zend_result sapi_send_headers(void);
 SAPI_API void sapi_free_header(sapi_header_struct *sapi_header);
 SAPI_API void sapi_handle_post(void *arg);
 SAPI_API void sapi_read_post_data(void);
 SAPI_API size_t sapi_read_post_block(char *buffer, size_t buflen);
-SAPI_API int sapi_register_post_entries(const sapi_post_entry *post_entry);
-SAPI_API int sapi_register_post_entry(const sapi_post_entry *post_entry);
+SAPI_API zend_result sapi_register_post_entries(const sapi_post_entry *post_entry);
+SAPI_API zend_result sapi_register_post_entry(const sapi_post_entry *post_entry);
 SAPI_API void sapi_unregister_post_entry(const sapi_post_entry *post_entry);
-SAPI_API int sapi_register_default_post_reader(void (*default_post_reader)(void));
-SAPI_API int sapi_register_treat_data(void (*treat_data)(int arg, char *str, zval *destArray));
-SAPI_API int sapi_register_input_filter(unsigned int (*input_filter)(int arg, const char *var, char **val, size_t val_len, size_t *new_val_len), unsigned int (*input_filter_init)(void));
+SAPI_API zend_result sapi_register_default_post_reader(void (*default_post_reader)(void));
+SAPI_API zend_result sapi_register_treat_data(void (*treat_data)(int arg, char *str, zval *destArray));
+SAPI_API zend_result sapi_register_input_filter(unsigned int (*input_filter)(int arg, const char *var, char **val, size_t val_len, size_t *new_val_len), unsigned int (*input_filter_init)(void));

-SAPI_API int sapi_flush(void);
+SAPI_API zend_result sapi_flush(void);
 SAPI_API zend_stat_t *sapi_get_stat(void);
 SAPI_API char *sapi_getenv(const char *name, size_t name_len);