php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #34334 $_ENV malformed; $_ENV['_'] == /usr/sbin/httpd
Submitted: 2005-09-01 19:51 UTC Modified: 2005-09-15 01:00 UTC
Votes:5
Avg. Score:3.4 ± 0.8
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:0 (0.0%)
From: tbarstow at workflowbydesignc dot om Assigned:
Status: No Feedback Package: CGI/CLI related
PHP Version: 5.0.4 OS: OS X "Tiger"
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2005-09-01 19:51 UTC] tbarstow at workflowbydesignc dot om
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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-09-01 23:43 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip


 [2005-09-15 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 22:01:28 2024 UTC