Work-around for glob() randomly failing for no reason
authorAlexander Ebert <ebert@woltlab.com>
Sun, 14 Dec 2014 21:08:01 +0000 (22:08 +0100)
committerAlexander Ebert <ebert@woltlab.com>
Sun, 14 Dec 2014 21:08:01 +0000 (22:08 +0100)
Closes #1835

wcfsetup/install/files/lib/system/cache/builder/ControllerCacheBuilder.class.php

index d11639de751137c3868bd67f50dd92e7b1c96d6c..78c75151fef29783c578b6330a9f767daf0bbaeb 100644 (file)
@@ -51,7 +51,12 @@ class ControllerCacheBuilder extends AbstractCacheBuilder {
                $controllers = array();
                $path .= $type . '/';
                
-               foreach (glob($path . '*' . ucfirst($type) . '.class.php') as $file) {
+               $files = glob($path . '*' . ucfirst($type) . '.class.php');
+               if ($files === false) {
+                       return array();
+               }
+               
+               foreach ($files as $file) {
                        $file = basename($file);
                        if (preg_match('~^([a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)(Action|Form|Page)\.class\.php$~', $file, $match)) {
                                if ($match[1] === 'I') {