From f53ebbf6727c98accaa677e91d35b502e76b39c8 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Tue, 17 Jan 2012 09:14:56 -0600 Subject: [PATCH] fix glob error in bundle class. --- laravel/bundle.php | 16 ++++++++++------ laravel/cli/command.php | 12 ++++++------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/laravel/bundle.php b/laravel/bundle.php index a34d2d67..7061df4a 100644 --- a/laravel/bundle.php +++ b/laravel/bundle.php @@ -271,10 +271,6 @@ public static function parse($identifier) /** * Detect all of the existing bundles in the application. * - * The names of the bundles are cached so this operation will be only be - * performed once and then the same array will be returned on each later - * request for the bundle names. - * * @return array */ public static function all() @@ -283,9 +279,17 @@ public static function all() $bundles = array(); - foreach (array_filter(glob(BUNDLE_PATH.'*'), 'is_dir') as $bundle) + $files = glob(BUNDLE_PATH.'*'); + + // When open_basedir is enabled the glob function returns false on + // an empty array. We'll check for this and return an empty array + // if the bundle directory doesn't have any bundles. + if ($files !== false) { - $bundles[] = basename($bundle); + foreach (array_filter($files, 'is_dir') as $bundle) + { + $bundles[] = basename($bundle); + } } return static::$bundles = $bundles; diff --git a/laravel/cli/command.php b/laravel/cli/command.php index 09f9c5a8..dbd226ba 100644 --- a/laravel/cli/command.php +++ b/laravel/cli/command.php @@ -71,17 +71,17 @@ public static function resolve($bundle, $task) { $identifier = Bundle::identifier($bundle, $task); - // First we'll check to see if the task has been registered in - // the application IoC container. This allows dependencies to - // be injected into tasks for more testability. + // First we'll check to see if the task has been registered in the + // application IoC container. This allows all dependencies to be + // injected into tasks for more testability. if (IoC::registered("task: {$identifier}")) { return IoC::resolve("task: {$identifier}"); } - // If the task file exists, we'll format the bundle and task - // name into a task class name and resolve an instance of - // the so that the requested method may be executed. + // If the task file exists, we'll format the bundle and task name + // into a task class name and resolve an instance of the so that + // the requested method may be executed. if (file_exists($path = Bundle::path($bundle).'tasks/'.$task.EXT)) { require $path;