CRM-13108 - Fix warning in CRM_Utils_File::findFiles (from rubofvil)
authorTim Otten <totten@civicrm.org>
Wed, 24 Jul 2013 17:41:23 +0000 (10:41 -0700)
committerTim Otten <totten@civicrm.org>
Wed, 24 Jul 2013 17:49:24 +0000 (10:49 -0700)
Note: According to http://php.net/glob, the return result varies by
platform; sometimes it returns array(), and sometimes it returns FALSE.
The patch should work with either case.

----------------------------------------
* CRM-13108: Warnings when extensions is installed
  http://issues.civicrm.org/jira/browse/CRM-13108

CRM/Utils/File.php

index 44350a47d01e53e6df3b2b1584634ff0ebfc9065..5d068bf18d4e6a1a1c2d295a5e56294e8256fd43 100644 (file)
@@ -529,9 +529,11 @@ HTACCESS;
     $result = array();
     while (!empty($todos)) {
       $subdir = array_shift($todos);
-      foreach (glob("$subdir/$pattern") as $match) {
-        if (!is_dir($match)) {
-          $result[] = $match;
+      if (is_array(glob("$subdir/$pattern"))) {
+        foreach (glob("$subdir/$pattern") as $match) {
+          if (!is_dir($match)) {
+            $result[] = $match;
+          }
         }
       }
       $dh = opendir($subdir);