]> granicus.if.org Git - php/commitdiff
Hope to finnally got it, fixes notice (Thx to Sebastian)
authorPierre Joye <pajoye@php.net>
Thu, 29 Aug 2002 10:08:37 +0000 (10:08 +0000)
committerPierre Joye <pajoye@php.net>
Thu, 29 Aug 2002 10:08:37 +0000 (10:08 +0000)
pear/System.php

index e2c35e6068e7c7117154789a2e99d1bd26551130..9808233cb96e7da8d3fa17abcb1421a85a027dc3 100644 (file)
@@ -385,44 +385,31 @@ class System
     /**
     * Get the path of the temporal directory set in the system
     * by looking in its environments variables.
+    * Note: php.ini-recommended removes the "E" from the variables_order setting,
+    * making unavaible the $_ENV array, that s why we do tests with _ENV
     *
     * @return string The temporal directory on the system
     */
     function tmpdir()
     {
         if (OS_WINDOWS) {
-            if (($var=$_ENV['TEMP']) || $var=getenv('TEMP')) {
-                 return $var;
+            if ($var = isset($_ENV['TEMP']) ? $_ENV['TEMP'] : getenv('TEMP')) {
+                return $var;
             }
-            if (($var=$_ENV['TMP']) || $var=getenv('TMP')) {
-                 return $var;
+            if ($var = isset($_ENV['TMP']) ? $_ENV['TMP'] : getenv('TMP')) {
+                return $var;
             }
-            if (($var=$_ENV['windir']) || $var=getenv('windir')) {
-                 return $var;
+            if ($var = isset($_ENV['windir']) ? $_ENV['windir'] : getenv('windir')) {
+                return $var;
             }
             return getenv('SystemRoot') . '\temp';
         }
-        if (($var=$_ENV['TMPDIR']) || $var=getenv('TMPDIR')) {
-             return $var;
+        if ($var = isset($_ENV['TMPDIR']) ? $_ENV['TMPDIR'] : getenv('TMPDIR')) {
+            return $var;
         }
         return '/tmp';
     }
 
-    /**
-    * (pajoye) Removed, problem with php.ini-recommanded, E removed
-    *
-    * (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)
     *