From: tuxracer69 at gmail dot com Operating system: Linux debi 2.6.17-2-k7 #1 SMP Fr PHP version: 5.2.0 PHP Bug Type: Unknown/Other Function Bug description: in the milter SAPI, the function smfi_getsymval always returns blank strings
Description: ------------ The milter SAPI seems unable to get the values of the sendmail macros using the smfi_getsymval function. My steup: 0) I compile PHP with "--with-milter --disable-cli --disable-cgi" 1) I create a script milter1.php (code below) 2) I insert in my /etc/mail/sendmail.mc the two lines below: ====== define(`MILTER',`1')dnl INPUT_MAIL_FILTER(`php-milter1',`S=local:/tmp/milter.sock,F=T,T=S:10m;R:10m;E:10m')dnl ====== 3) I start the milter with: php-milter -D -p /tmp/milter.sock milter1.php 4) I forge a mail to localhot using telnet to port 25 5) I look at the milter logs which shoud display the vaue of the "i" sendmail macro (the sendmail queueid). Reproduce code: --------------- <?php function milter_log($msg) { $GLOBALS['log'] = fopen("/var/log/milter.log", "a"); fwrite($GLOBALS['log'], date("[H:i:s d.m.Y] p").getmypid()."\t{$msg}\n"); fclose($GLOBALS['log']); } function milter_init() { milter_log("-- startup --"); milter_log("milter_init()"); } function milter_envfrom($args){ $queueid=smfi_getsymval("i"); milter_log("queueid=".$queueid); milter_log("milter_envfrom(args[])"); foreach ($args as $ix => $arg) { milter_log("\targs[$ix] = $arg"); } } ?> Expected result: ---------------- After having started the milter: # php-milter -D -p /tmp/milter.sock milter1.php I forge a mail: # telnet localhost 25 Trying 127.0.0.1... Connected to debi. Escape character is '^]'. 220 debi.local. ESMTP Sendmail 8.13.7/8.13.7/Debian-2; Tue, 9 Jan 2007 21:25:35 +0100; (No UCE/UBE) logging access from: debi(OK)-debi [127.0.0.1] helo me 250 debi.local. Hello debi [127.0.0.1], pleased to meet you mail from: [EMAIL PROTECTED] 250 2.1.0 [EMAIL PROTECTED] Sender ok quit 221 2.0.0 debi.local. closing connection Connection closed by foreign host. I get the queueid from the sendmail logs: # tail -n 1 /var/log/mail.log Jan 9 21:25:55 debi sm-mta[14429]: l09KPZRk014429: [EMAIL PROTECTED], size=0, class=0, nrcpts=0, proto=SMTP, daemon=MTA-v4, relay=debi [127.0.0.1] And a would expect a line in the milter logs saying [21:25:49 09.01.2007] p14426 queueid=l09KPZRk014429 But (see below the logs I get), I can not get any value for the "i" macro. I am sure it is set. If I strace -v -f the milter I see the queueid in a read system call. Actual result: -------------- The third line in the milter logs shows a blank queueid tail -f /var/log/milter.log [21:25:26 09.01.2007] p14426 -- startup -- [21:25:26 09.01.2007] p14426 milter_init() [21:25:49 09.01.2007] p14426 queueid= [21:25:49 09.01.2007] p14426 milter_envfrom(args[]) [21:25:49 09.01.2007] p14426 args[0] = [EMAIL PROTECTED] I tried to modify my PHP code and call the macro "{i}" but it does not help. I would say it is a PHP bug and not a sendmail bug; here is my sendmail version anyway: # sendmail -d0.1 Version 8.13.7 Compiled with: DNSMAP LDAPMAP LDAP_REFERRALS LOG MAP_REGEX MATCHGECOS MILTER MIME7TO8 MIME8TO7 NAMED_BIND NETINET NETINET6 NETUNIX NEWDB NIS NISPLUS PIPELINING SASLv2 SCANF SOCKETMAP STARTTLS USERDB USE_LDAP_INIT XDEBUG ============ SYSTEM IDENTITY (after readcf) ============ (short domain name) $w = debi (canonical domain name) $j = debi.local. (subdomain name) $m = local. (node name) $k = debi ======================================================== -- Edit bug report at http://bugs.php.net/?id=40083&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40083&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40083&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40083&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=40083&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=40083&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=40083&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=40083&r=needscript Try newer version: http://bugs.php.net/fix.php?id=40083&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=40083&r=support Expected behavior: http://bugs.php.net/fix.php?id=40083&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=40083&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=40083&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=40083&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40083&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=40083&r=dst IIS Stability: http://bugs.php.net/fix.php?id=40083&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=40083&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=40083&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=40083&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=40083&r=mysqlcfg