Skip to content

mb_send_mail() ignores $additional_params on PHP 8.6 #25737

Done

Description

@thunderer

Description

On PHP 8.6, mb_send_mail() ignores $additional_params when mail.force_extra_parameters is not set, which is the default.

The following code, run with -d 'sendmail_path="cat > /dev/null; echo sendmail arguments:"', which prints the arguments that PHP passes to sendmail:

<?php
mb_send_mail("user@example.com", "subject", "message", [], "-fsender@example.com");

Resulted in this output:

sendmail arguments:

But I expected this output instead (PHP 8.4 and 8.5 print it):

sendmail arguments: -fsender@example.com

b621f80 (GH-21393) replaced zend_ini_str_ex() with zend_ini_str_literal(). For a setting without a value, the first returns NULL and the second returns an empty string. The check if (force_extra_parameters) is therefore always true, and the empty string replaces $additional_params.

I have a patch with a test and will open a PR against PHP-8.6.

PHP Version

PHP 8.6.1-dev (cli) (built: Nov 25 2026 12:40:30) (NTS DEBUG)
Copyright © The PHP Group and Contributors
Zend Engine v4.6.1-dev, Copyright © Zend by Perforce
    with Zend OPcache v8.6.1-dev, Copyright ©, by Zend by Perforce

PHP-8.6 branch at 6debfb4. Also reproduced with PHP 8.6.0.

Operating System

Debian 13 (php:8.6-cli Docker image, PHP built from source)

Activity

  1. added 2 commits that reference this issue on Nov 25, 2026
    8bc8c3f
    291dcac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions