glob returns false on openshift
authorMichael Wallner <mike@php.net>
Tue, 14 Oct 2014 16:39:26 +0000 (18:39 +0200)
committerMichael Wallner <mike@php.net>
Tue, 14 Oct 2014 16:39:26 +0000 (18:39 +0200)
mdref/Tree.php

index d9e2b0db2149221b82e99d65fb43c4bddce90adb..dd27d6fd0f94ca8616031f1127a3d14a38f0ac59 100644 (file)
@@ -13,7 +13,7 @@ class Tree implements \RecursiveIterator {
         * List of first level entries
         * @var array
         */
-       private $list;
+       private $list = array();
        
        /**
         * The list iterator
@@ -29,8 +29,10 @@ class Tree implements \RecursiveIterator {
                if (!($list = glob("$path/*.md"))) {
                        $list = glob("$path/*/*.md");
                }
-               $this->list = array_filter($list, $this->generateFilter($list));
-               sort($this->list, SORT_STRING);
+               if ($list) {
+                       $this->list = array_filter($list, $this->generateFilter($list));
+                       sort($this->list, SORT_STRING);
+               }
                $this->repo = $repo;
        }