Skip to content

ext/imap/tests/bug77020.phpt tries to send mail #11629

Closed
@orlitzky

Description

@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:

        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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions