ソースを参照

* Potential fix for Win32 builds where 'getrusage' is a function but is not
supported. I ignore the warning and check the result to make sure it is
an array.

Tyler Akins 24 年 前
コミット
1dee739d76
1 ファイル変更11 行追加7 行削除
  1. 11 7
      functions/strings.php

+ 11 - 7
functions/strings.php

@@ -368,13 +368,17 @@
       
       // getrusage
       if (function_exists('getrusage')) {
-         $dat = getrusage();
-          $Str = '';
-          foreach ($dat as $k => $v)
-          {
-              $Str .= $k . $v;
-          }
-          sq_mt_seed(md5($Str));
+         // Avoid warnings with Win32
+         $dat = @getrusage();
+	 if (isset($dat) && is_array($dat))
+	 {
+            $Str = '';
+            foreach ($dat as $k => $v)
+            {
+               $Str .= $k . $v;
+            }
+            sq_mt_seed(md5($Str));
+	 }
       }
       
       // Apache-specific