From:             tbarstow at workflowbydesignc dot om
Operating system: OS X "Tiger"
PHP version:      5.0.4
PHP Bug Type:     CGI related
Bug description:  $_ENV malformed; $_ENV['_'] == /usr/sbin/httpd

Description:
------------
I have a CLI PHP script that is run via cron.  Most of the time (about
75%) it runs without issue.  Sometimes, however, I get output similar to
the following in my log file:

[01-Sep-2005 13:30:40] PHP Notice:  Undefined index:  HOME in
/path/to/file.php on line xx
[01-Sep-2005 13:30:40] Array
(
    [PATH] =>
/bin:/sbin:/usr/bin:/usr/sbin:/usr/libexec:/System/Library/CoreServices
    [PWD] => /
    [SHLVL] => 3
    [_] => /usr/sbin/httpd
)

Note that PHP and only PHP writes into this log file.

Reproduce code:
---------------
$scriptdir = "$_ENV[HOME]/automation";
error_log(print_r($_ENV,true));



Expected result:
----------------
I expect to see the $_ENV array printed into the log file, with the name
of the currently running php script in $_ENV['_'].  I also expect to see
no error from the line that references $_ENV['HOME'].  

Here is a "normal" entry, generated by the exact same script:

[01-Sep-2005 13:46:01] Array
(
    [SHELL] => /bin/sh
    [USER] => wbd
    [SCRIPT_PATH] => /Users/wbd/automation
    [PATH] => /usr/bin:/bin
    [PWD] => /Users/wbd
    [SHLVL] => 1
    [HOME] => /Users/wbd
    [LOG_PATH] => /Users/wbd/automation/_logs
    [LOGNAME] => wbd
    [_] => /Users/wbd/automation/_shared/everyMinute.php
    [__CF_USER_TEXT_ENCODING] => 0x1F5:0:0
)

Actual result:
--------------
See log entry above.

-- 
Edit bug report at http://bugs.php.net/?id=34334&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=34334&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=34334&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=34334&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=34334&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=34334&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=34334&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=34334&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=34334&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=34334&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=34334&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=34334&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=34334&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=34334&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=34334&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=34334&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=34334&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=34334&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=34334&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=34334&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=34334&r=mysqlcfg

Reply via email to