[php-src] master: Fix GH-25737: mb_send_mail() ignores $additional_params (#25739)

From: Date: Wed, 25 Nov 2026 17:46:27 +0000
Subject: [php-src] master: Fix GH-25737: mb_send_mail() ignores $additional_params (#25739)
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-144169@lists.php.net to get a copy of this message
Author: Tomasz Kowalczyk (thunderer) Committer: Weilin Du (LamentXU123) Date: 2026-11-26T01:26:32+08:00 Commit: https://github.com/php/php-src/commit/8bc8c3f94cf373dcf03add9982690aa224f6bb57 Raw diff: https://github.com/php/php-src/commit/8bc8c3f94cf373dcf03add9982690aa224f6bb57.diff Fix GH-25737: mb_send_mail() ignores $additional_params (#25739) Restore the previous INI lookup so that an unset mail.force_extra_parameters leaves $additional_params in effect. An explicitly empty setting still overrides $additional_params, preserving the PHP 8.5 behavior. Add a regression test that checks the argument passed to sendmail. Closes #25739 Changed paths: A ext/mbstring/tests/gh25737.phpt M NEWS M ext/mbstring/mbstring.c Diff: diff --git a/NEWS b/NEWS index 55365b31983b..4ac9fa5c5104 100644 --- a/NEWS +++ b/NEWS @@ -110,6 +110,8 @@ PHP NEWS deeply nested arrays. (Eyüp Can Akman) . Fixed the JIT freeing the string returned by mb_encode_mimeheader() or mb_output_handler() while it is still in use. (Ilia Alshanetsky) + . Fixed bug GH-25737 (mb_send_mail() ignores $additional_params). + (Tomasz Kowalczyk) - Opcache: . Fixed bug GH-22216 (spurious opcache.memory_consumption warning on each new diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index d2e17d6c0bc4..88e7d7f5f832 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -4848,7 +4848,7 @@ PHP_FUNCTION(mb_send_mail) str_headers = smart_str_extract(&str); - zend_string *force_extra_parameters = zend_ini_str_literal("mail.force_extra_parameters"); + zend_string *force_extra_parameters = zend_ini_str_ex(ZEND_STRL("mail.force_extra_parameters"), false, NULL); if (force_extra_parameters) { extra_cmd = php_escape_shell_cmd(force_extra_parameters); } else if (extra_cmd) { diff --git a/ext/mbstring/tests/gh25737.phpt b/ext/mbstring/tests/gh25737.phpt new file mode 100644 index 000000000000..6118c812b356 --- /dev/null +++ b/ext/mbstring/tests/gh25737.phpt @@ -0,0 +1,17 @@ +--TEST-- +GH-25737 (mb_send_mail() ignores $additional_params) +--EXTENSIONS-- +mbstring +--SKIPIF-- +<?php +if (PHP_OS_FAMILY === "Windows") die("skip Won't run on Windows"); +?> +--INI-- +sendmail_path="cat > /dev/null; echo sendmail arguments:" +--FILE-- +<?php +var_dump(mb_send_mail("user@example.com", "subject", "message", [], "-fsender@example.com")); +?> +--EXPECT-- +sendmail arguments: -fsender@example.com +bool(true)

« previous php.cvs (#144169) next »