Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Commit

Permalink
Merge PR #5783 to develop
Browse files Browse the repository at this point in the history
Merge branch 'hotfix/standard-autoloader-stack' of git://github.com/weierophinney/zf2 into weierophinney-hotfix/standard-autoloader-stack

* 'hotfix/standard-autoloader-stack' of git://github.com/weierophinney/zf2:
  [#5783] Assertion on return value
  Do not exit from loadClass() early
  • Loading branch information
Ralph Schindler committed Feb 5, 2014
2 parents 18e2f00 + 70cd8a5 commit 2ae43e3
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
1 change: 0 additions & 1 deletion library/Zend/Loader/StandardAutoloader.php
Expand Up @@ -302,7 +302,6 @@ protected function loadClass($class, $type)
if (file_exists($filename)) {
return include $filename;
}
return false;
}
}
return false;
Expand Down
9 changes: 9 additions & 0 deletions tests/ZendTest/Loader/StandardAutoloaderTest.php
Expand Up @@ -190,4 +190,13 @@ public function testCanTellAutoloaderToRegisterZendNamespaceAtInstantiation()
$this->assertAttributeEquals($expected, 'namespaces', $loader);
}

public function testWillLoopThroughAllNamespacesUntilMatchIsFoundWhenAutoloading()
{
$loader = new StandardAutoloader();
$loader->registerNamespace('ZendTest\Loader\TestAsset\Parent', __DIR__ . '/TestAsset/Parent');
$loader->registerNamespace('ZendTest\Loader\TestAsset\Parent\Child', __DIR__ . '/TestAsset/Child');
$result = $loader->autoload('ZendTest\Loader\TestAsset\Parent\Child\Subclass');
$this->assertTrue($result !== false);
$this->assertTrue(class_exists('ZendTest\Loader\TestAsset\Parent\Child\Subclass', false));
}
}
17 changes: 17 additions & 0 deletions tests/ZendTest/Loader/TestAsset/Child/Subclass.php
@@ -0,0 +1,17 @@
<?php
/**
* Zend Framework (http://framework.zend.com/)
*
* @link http://github.com/zendframework/zf2 for the canonical source repository
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/

namespace ZendTest\Loader\TestAsset\Parent\Child;

/**
* @group Loader
*/
class Subclass
{
}
Empty file.

0 comments on commit 2ae43e3

Please sign in to comment.