php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #30059 $_SERVER[SystemRoot] is empty
Submitted: 2004-09-10 23:27 UTC Modified: 2004-09-16 10:30 UTC
From: rograham at compuserve dot com Assigned:
Status: Closed Package: Documentation problem
PHP Version: 4.3.8 OS: Windows 2000
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: rograham at compuserve dot com
New email:
PHP Version: OS:

 

 [2004-09-10 23:27 UTC] rograham at compuserve dot com
Description:
------------
phpinfo() indicates correct SystemRoot value
for Environment (in my case D:\WINNT)
but $_SERVER[SystemRoot] and $_ENV[SystemRoot]
both return empty.

vardump of $GLOBALS shows:
["HTTP_SERVER_VARS"]=> array(34) {...}
["_SERVER"]=> array(34) {...}
["HTTP_ENV_VARS"]=>array(0) {}
["_ENV"]=> array(0) {}

This may be "working as designed", but it appears
that the whole issue of global variables registration
has altered things.

See below post for SugarCRM which uses JPGraph
which relied upon [SystemRoot] values.

VVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVVV

Using PHP 4.3.8 and IIS 5.0 (isapi) and JPGraph 1.1.6 (or JPGraph 1.1.5)

Problem in jpgraph.php for the path definition of the Font directory (and Cache as well) for Windows systems.
JPGraph presumes that $_SERVER[SystemRoot] is a valid PHP predefined variable (it isn't). JPGraph 1.1.5 similarly used $_ENV[SystemRoot].

While trying to solve this problem, I upgraded to JPGraph 1.1.6 because I could see from other posts that there were some problems caused by PHP variable registration policies.

THIS MAY JUST BE TRUE FOR ISAPI but the current PHP manual does not list "SystemRoot" as a valid $_SYSTEM variable. A key aspect of $_ENV variables is that they are diversely popluated by different environments, so this might have worked in the past for prior versions.

It is odd, because phpinfo() does list the "SystemRoot" value (correctly).

Each jpgraph.php script actually dies because the $_SYSTEM[SystemRoot]value is empty. You don't see the die message...which was obsolete anyways.
Of course you don't see the graph either.

Easy solution (so far) is to update jpg-config.inc in the jpgraph/src subdirectory to explicitly:
DEFINE("TTF_DIR","yoursystemroot/FONTS/");
Mine is now:
DEFINE("TTF_DIR","D:/WINNT/FONTS/");
The defective code is bypassed if the path is predefined this way.

Now I get the pretty graphs in SugarSales!!
Will contact JPGraph to update/correct their code/guidance.
Will also post to PHP for documentation.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-11 00:22 UTC] rograham at compuserve dot com
OK. It is making more sense now since I have been
using the php.ini-recommended version which has:
register_globals = off
variables_order = "GPCS"

So (as the comments clearly say), in order to access
environment variables, you can (MUST) use getenv() instead.
The $HTTP_ENV_VARS and $_ENV arrays remain empty.
 [2004-09-11 15:21 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php


 [2004-09-13 02:16 UTC] rograham at compuserve dot com
I realize that the Summary and Comment History do not accurately summarize this documentation bug, but they do provide context for it....

The current PHP manual states in
LXXXVIII. PHP Options&Information
for getenv()

"Note: This function does not work in ISAPI mode"

For my 4.3.8 system running php4isapi.dll
the call to getenv('SystemRoot') returns
the expected path value (D:\WINNT)for SystemRoot 
(same as shown in the phpinfo() results).

For this capability, I am grateful and simply
request that the getenv() functionality be
documented as supported for ISAPI. I realize
that this may require checking all of the parameters
in order to update the documentation more precisely.

If the functionality was removed for PHP5, then
the upgrade documentation should indicate that fact
(that the code complies with the documentation as of V5).

If you elect to disable getenv() for ISAPI, then could you
please suggest how an ISAPI script is supposed to acquire
that environmental information if the ENV array is no longer populated (per your recommended php.ini)?
 [2004-09-16 10:30 UTC] vrana@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.

That note was bogus, it didn't work before PHP 4.0b3 or so.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jun 13 02:01:35 2024 UTC