Bug #78757 [Ver->Csd]: Default sendmail_path gets populated incorrectly when sendmail is not found
Edit report at https://bugs.php.net/bug.php?id=78757&edit=1
ID: 78757
Updated by: petk@php.net
Reported by: indrek at ardel dot eu
Summary: Default sendmail_path gets populated incorrectly
when sendmail is not found
-Status: Verified
+Status: Closed
Type: Bug
Package: *Compile Issues
PHP Version: Irrelevant
-Assigned To:
+Assigned To: petk
Block user comment: N
Private report: N
New Comment:
This has been fixed via https://github.com/php/php-src/pull/5548
and configure log enhanced via https://github.com/php/php-src/pull/14955
Previous Comments:
------------------------------------------------------------------------
[2019-10-29 17:24:05] cmb@php.net
Indeed, it seems PHP_PROG_SENDMAIL is set unconditionally[1].
[1] <https://github.com/php/php-src/blob/php-7.3.11/acinclude.m4#L2086>
------------------------------------------------------------------------
[2019-10-29 00:35:08] indrek at ardel dot eu
Description:
------------
When sendmail cannot be found on the system during compile time, the default config for PHP will be
populated as if it was found.
If we take a look at https://github.com/php/php-src/blob/c2f56d0546832abee24961daf47872ccebd52266/main/main.c#L714-L720
then placing an #error macro to the elif branch shows that PHP_PROG_SENDMAIL seems to be defined
regardless of whether it is actually found on the system. If sendmail is found, then it's the
path of the executable, but when it isn't, then it will be an empty string. To rule out the
obvious, I do get checking for sendmail... no when it's not installed, as
expected. Test was performed in Debian Buster.
For cases where sendmail is not found, this results in default value being an unusable
sendmail_path = -t -i instead of the expected sendmail_path = /usr/sbin/sendmail
-t -i, which in source currently seems to be part of unreachable code.
A valid use case of sendmail not existing at the compile time would be for instance Docker
containers. If the consumer desires, they can install sendmail on top of an existing PHP container,
however for it to currently work there, they would have to also override the sendmail_path in
configuration. In most cases sendmail will appear at /usr/sbin/sendmail when installed, so including
it by default would spare anyone from explicitly configuring it.
As far as I can tell, this behavior has existed for a long time and thus I am unable to pinpoint a
version where it last time worked as expected. Bug #43591 seems to be the original issue that in my
opinion is on point, but the response about register_globals seems too odd for me, so I think this
was dismissed incorrectly. I'd like for someone to take a second look at it.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=78757&edit=1
Thread (3 messages)