Fixed bug #9790: class.gzip_encode.php fails with open_basedir restrictions
authorDmitry Dulepov <dmitry.dulepov@gmail.com>
Mon, 1 Dec 2008 16:25:00 +0000 (16:25 +0000)
committerDmitry Dulepov <dmitry.dulepov@gmail.com>
Mon, 1 Dec 2008 16:25:00 +0000 (16:25 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/branches/TYPO3_4-2@4516 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.gzip_encode.php

index b6ab220..4c3a834 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2008-12-01  Dmitry Dulepov  <dmitry@typo3.org>
+
+       * Fixed bug #9790: class.gzip_encode.php fails with open_basedir restrictions
+
 2008-12-01  Steffen Kamper  <info@sk-typo3.de>
 
        * Fixed bug #9864: felogin: Drop languages from locallang.xml
index 4e1b3c2..52b1b5d 100755 (executable)
@@ -339,13 +339,15 @@ class gzip_encode {
         * @return      float           Returns the current load average
         */
        function linux_loadavg() {
-               $buffer = "0 0 0";
-               $f = fopen("/proc/loadavg","rb");
-               if (!feof($f)) {
-                   $buffer = fgets($f, 1024);
+               $buffer = '0 0 0';
+               $f = @fopen('/proc/loadavg', 'rb');
+               if ($f) {
+                       if (!feof($f)) {
+                               $buffer = fgets($f, 1024);
+                       }
+                       fclose($f);
                }
-               fclose($f);
-               $load = explode(" ",$buffer);
+               $load = explode(' ', $buffer);
                return max((float)$load[0], (float)$load[1], (float)$load[2]);
        }