[php-src] Issue #11629: ext/imap/tests/bug77020.phpt tries to send mail
| From: | orlitzky | Date: | Fri, 07 Jul 2023 23:11:43 +0000 |
| Subject: | [php-src] Issue #11629: ext/imap/tests/bug77020.phpt tries to send mail | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-244912@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/11629
Author: orlitzky
### Description
I noticed today that this test actually tries to send mail:
```
$ cat ext/imap/tests/bug77020.phpt
--TEST--
Bug #77020 (null pointer dereference in imap_mail)
--EXTENSIONS--
imap
--FILE--
<?php
@imap_mail('1', 1, NULL);
echo 'done'
?>
--EXPECTF--
%Adone
```
In the docs, the
imap_mail() function is a bit mysterious, but if you read
ext/imap/php_imap.c, then basically, it runs sendmail:
```C
if (!INI_STR("sendmail_path")) {
return 0;
}
sendmail = popen(INI_STR("sendmail_path"), "w");
if (sendmail) {
...
```
I was a little surprised to see it try to relay through my mail server (which is what
/usr/bin/sendmail is configured to do by default):
```
Jul 07 17:51:31 [postfix/cleanup] 43FF23635AF: message-id=<20230707215131.43FF23635AF@gantu>
Jul 07 17:51:31 [postfix/qmgr] 43FF23635AF: from=<root@gantu.localdomain>, size=272, nrcpt=1
(queue active)
Jul 07 17:51:31 [postfix/smtp] 43FF23635AF: to=<1@gantu.localdomain>, orig_to=<1> ...
554 5.7.1 <1@gantu.localdomain>: Recipient address rejected: Access denied (in reply to RCPT
TO command))
```
I can probably fix this in our distribution package by setting sendmail_path =
/bin/true or something like that, but I think it's a big enough surprise to report. A
similar solution might work in the test itself, but I don't know what we could use on Windows.
### PHP Version
php-8.2.8
### Operating System
_No response_