Commit 402f0843737 for php.net
commit 402f08437377660ec7cb15aa4b207594dddd7231
Author: Gina Peter Banyard <girgias@php.net>
Date: Wed Dec 24 17:37:43 2025 +0100
ext/standard/mail.c: use php_mail_build_headers_elem() directly
The branching logic is already defined in the function
diff --git a/ext/standard/mail.c b/ext/standard/mail.c
index 0d1b34d7166..0788d54ebf0 100644
--- a/ext/standard/mail.c
+++ b/ext/standard/mail.c
@@ -245,13 +245,7 @@ PHPAPI zend_string *php_mail_build_headers(const HashTable *headers)
} else if (zend_string_equals_literal_ci(key, "subject")) {
zend_value_error("The additional headers cannot contain the \"Subject\" header");
} else {
- if (Z_TYPE_P(val) == IS_STRING) {
- php_mail_build_headers_elem(&s, key, val);
- } else if (Z_TYPE_P(val) == IS_ARRAY) {
- php_mail_build_headers_elems(&s, key, val);
- } else {
- zend_type_error("Header \"%s\" must be of type array|string, %s given", ZSTR_VAL(key), zend_zval_value_name(val));
- }
+ php_mail_build_headers_elem(&s, key, val);
}
if (EG(exception)) {