Re: why is this not a bug?
| From: | Dan Donaldson | Date: | Thu, 13 Jul 2000 14:31:04 +0000 |
| Subject: | Re: why is this not a bug? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-6451@lists.php.net to get a copy of this message | ||
On 7/13/00 at 9:58 AM, kbeckford@bigorbit.com (Kevin Beckford) expostulated:
> > If I configure php4 such that I tell it sendmail_path is /usr/local/turkey
-t
> > (not a valid filename) it, still merrily returns '1' when I invoke mail().
> How
> > can it return a true value on a command that has to fail?
>
> Unix exit code for success is 0 . An exit status of 1 indicates an error. It
> seems to me that this is working properly, unless you renamed or soft linked
to
> sendmail for some reason.
>
>
sendmail is in the designated location, not soft linked.
I didn't know that 'true' meant failure in Unix (and that weirds me out, given
the code snippet provided by Rasmus:)
> > From ext/standard/mail.c:
> >
> > sendmail = popen(sendmail_path, "w");
> >
> > if (sendmail) {
> > fprintf(sendmail, "To: %s\n", to);
> > fprintf(sendmail, "Subject: %s\n", subject);
> > if (headers != NULL) {
> > fprintf(sendmail, "%s\n", headers);
> > }
> > fprintf(sendmail, "\n%s\n", message);
> > ret = pclose(sendmail);
> > if (ret == -1) {
> > return 0;
> > } else {
> > return 1;
> > }
> > } else {
> > php_error(E_WARNING, "Could not execute mail delivery program");
> > return 0;
> > }
which is unambiguously testing for values of non-zero for success and providing
a zero value for failure... according to the code above, when the test for
sendmail comes back as zero (indicating success), it should return an error, so
how can what you assert be true?
dan
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>
-----------------------------------------------------
omnivore: omnivore@sympatico.ca
Networked and Desktop interactive technologies
tel: +1 416 603 3309
Build surveys online with surveys123: http://www.surveys123.com
Your Online Science & Astronomy Superstore: http://www.e-sci.com