Skip to content

Stdlib: mail.add_x_header emits X-PHP-Originating-Script (#21433) - #21437

Merged
PurHur merged 1 commit into
masterfrom
agent/advanced-stdlib-21433-mail-add-x-header
Jul 20, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/advanced-stdlib-21433-mail-add-x-header

Conversation

@PurHur

@PurHur PurHur commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • Startup -d mail.add_x_header / PHPT --INI-- sets VmIni::$mailAddXHeader.
  • mail() prepends X-PHP-Originating-Script: {uid}:{basename} when enabled (php-src php_mail() PG(mail_x_header)).
  • ini_get('mail.add_x_header') returns 0/1 (removed from empty-string INI list).

php-src: ext/standard/mail.c (php_mail).
PHP: ext/standard/VmMail.php, ext/standard/VmIni.php.

Closes #21433

Test plan

  • php bin/vm.php -d sendmail_path=… -d mail.add_x_header=1 test/repro/issue_21433_mail_add_x_header.phpOK
  • vendor/bin/phpunit test/compliance/VMTest.php --filter 'mail_add_x_header|mail_headers…' → OK (7)

Made with Cursor

Honor CLI/PHPT mail.add_x_header and prepend X-PHP-Originating-Script:{uid}:{basename} before piping to sendmail, matching php-src php_mail().

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stdlib: mail.add_x_header — X-PHP-Originating-Script (ext/standard/mail.c)

1 participant