Skip to content

Commit

Permalink
Fixes #8 - Zend_Loader_ClassMapAutoloader is not auto included
Browse files Browse the repository at this point in the history
  • Loading branch information
froschdesign authored and Dimitris Giotas committed Jun 17, 2016
1 parent f5e0810 commit 8dea2f4
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion library/Zend/Loader/AutoloaderFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@
*/
abstract class Zend_Loader_AutoloaderFactory
{
const STANDARD_AUTOLOADER = 'Zend_Loader_StandardAutoloader';
const STANDARD_AUTOLOADER = 'Zend_Loader_StandardAutoloader';
const CLASS_MAP_AUTOLOADER = 'Zend_Loader_ClassMapAutoloader';

/**
* @var array All autoloaders registered using the factory
Expand Down Expand Up @@ -89,6 +90,19 @@ public static function factory($options = null)

foreach ($options as $class => $options) {
if (!isset(self::$loaders[$class])) {
// Check class map autoloader
if ($class == self::CLASS_MAP_AUTOLOADER) {
if (!class_exists(self::CLASS_MAP_AUTOLOADER)) {
// Extract the filename from the classname
$classMapLoader = substr(
strrchr(self::CLASS_MAP_AUTOLOADER, '_'), 1
);

require_once dirname(__FILE__) . "/$classMapLoader.php";
}
}

// Autoload with standard autoloader
$autoloader = self::getStandardAutoloader();
if (!class_exists($class) && !$autoloader->autoload($class)) {
require_once 'Exception/InvalidArgumentException.php';
Expand Down

0 comments on commit 8dea2f4

Please sign in to comment.