summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomas V.V.Cox <cox@php.net>2002-07-26 10:18:28 +0000
committerTomas V.V.Cox <cox@php.net>2002-07-26 10:18:28 +0000
commitedfb9d44e43f9a2baf4672ae3f9f8a594340e487 (patch)
tree7b099e37b99ca8810d5310782cd707756e7e6705
parent6eed1b02432ecbd3e38390d2c6860e2c947cc5dc (diff)
downloadphp-git-edfb9d44e43f9a2baf4672ae3f9f8a594340e487.tar.gz
Workarround to the empty $_ENV
-rw-r--r--pear/System.php32
1 files changed, 22 insertions, 10 deletions
diff --git a/pear/System.php b/pear/System.php
index f9699781f3..ab3a9642e1 100644
--- a/pear/System.php
+++ b/pear/System.php
@@ -389,25 +389,37 @@ class System
*/
function tmpdir()
{
- if (OS_WINDOWS){
- if (isset($_ENV['TEMP'])) {
- return $_ENV['TEMP'];
+ if (OS_WINDOWS) {
+ if (System::_myenv('TEMP')) {
+ return System::_myenv('TEMP');
}
- if (isset($_ENV['TMP'])) {
- return $_ENV['TMP'];
+ if (System::_myenv('TMP')) {
+ return System::_myenv('TMP');
}
- if (isset($_ENV['windir'])) {
- return $_ENV['windir'] . '\temp';
+ if (System::_myenv('windir')) {
+ return System::_myenv('windir') . '\temp';
}
- return $_ENV['SystemRoot'] . '\temp';
+ return System::_myenv('SystemRoot') . '\temp';
}
- if (isset($_ENV['TMPDIR'])) {
- return $_ENV['TMPDIR'];
+ if (System::_myenv('TMPDIR')) {
+ return System::_myenv('TMPDIR');
}
return '/tmp';
}
/**
+ * (cox) I always get $_ENV empty in both Windows and Linux
+ * with all PHP version <= 4.2.1
+ */
+ function _myenv($var)
+ {
+ if (!empty($_ENV)) {
+ return isset($_ENV[$var]) ? $_ENV[$var] : false;
+ }
+ return getenv($var);
+ }
+
+ /**
* The "type" command (show the full path of a command)
*
* @param string $program The command to search for