From 7d5e4f76fbc072283a0c8e80cffb77a31149a811 Mon Sep 17 00:00:00 2001 From: Joe Holdcroft Date: Thu, 17 Jan 2013 14:12:03 +0000 Subject: [PATCH] Bug fix & changing loop + array_unshift to array_merge --- src/Composer/Autoload/ClassLoader.php | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/Composer/Autoload/ClassLoader.php b/src/Composer/Autoload/ClassLoader.php index 9c039d4ea..db39073eb 100644 --- a/src/Composer/Autoload/ClassLoader.php +++ b/src/Composer/Autoload/ClassLoader.php @@ -84,12 +84,17 @@ class ClassLoader public function add($prefix, $paths, $prepend = false) { if (!$prefix) { - foreach ((array) $paths as $path) { - if ($prepend) { - array_unshift($this->fallbackDirs, $path); - } else { - $this->fallbackDirs[] = $path; - } + if ($prepend) { + $this->fallbackDirs = array_merge( + (array) $paths, + $this->fallbackDirs + ); + } + else { + $this->fallbackDirs = array_merge( + $this->fallbackDirs, + (array) $paths + ); } return; @@ -121,7 +126,7 @@ class ClassLoader public function set($prefix, $paths) { if (!$prefix) { - $this->fallbackDirs = (array) $path; + $this->fallbackDirs = (array) $paths; return; }