PHP 4.0 Bug #6104: popen returns -1

From: Date: Fri, 11 Aug 2000 10:23:11 +0000
Subject: PHP 4.0 Bug #6104: popen returns -1
Groups: php.dev 
Request: Send a blank email to php-dev+get-28518@lists.php.net to get a copy of this message
From: Alan@Halachmi.net Operating system: Solaris 8 PHP version: 4.0.1pl2 PHP Bug Type: Misbehaving function Bug description: popen returns -1 This code snippit from horde.lib (www.horde.org): // Finally, send the mail. if (@is_executable($default->path_to_sendmail)) { $mail = popen("$default->path_to_sendmail -i -f$from -- $recipients", 'w'); $result = fputs($mail, $bhdrs . $hdrs); echo "1: " . $result; $result += fputs($mail, "\n"); // trailing \n to end the headers section echo "2: " . $result; $result += fputs($mail, $body); echo "3: " . $result; if (pclose($mail) != 0) $result = 0; echo "4: " . $result; } else { if (empty($envelope['To'])) $envelope['To'] = ''; if (empty($envelope['Subject'])) $envelope['Subject'] = ''; if (mail($envelope['To'], $envelope['Subject'], $body, $hdrs . $mhdrs)) $result = 1; else $result = 0; } Yields the following output: 1: 345 2: 346 3: 354 4: 0 The return value of pclose() is not the exit status of the program, but a value as returned by waitpid() of wait4(). I've run what the popen command-line calls by hand using truss, and sendmail is returning exit(0). So, I dug a bit further... pclose($mail) is returning -1. Any ideas on how I can track down why? This function is not reported to be misbehaving on other platforms.

« previous php.dev (#28518) next »