Index: tests/Zend/Loader/PluginLoaderTest.php =================================================================== --- tests/Zend/Loader/PluginLoaderTest.php (revision 21161) +++ tests/Zend/Loader/PluginLoaderTest.php (working copy) @@ -479,6 +479,23 @@ $classPath = $loader->getClassPath('DeclareVars'); $this->assertContains($expected, $classPath); } + + /** + * @group ZF-7350 + */ + public function testPrefixesEndingInBackslashDenoteNamespacedClasses() + { + $loader = new Zend_Loader_PluginLoader(array()); + $loader->addPrefixPath('Zfns\\', dirname(__FILE__) . '/_files/Zfns'); + try { + $className = $loader->load('Foo'); + } catch (Exception $e) { + $paths = $loader->getPaths(); + $this->fail(sprintf("Failed loading helper; paths: %s", var_export($paths, 1))); + } + $this->assertEquals('Zfns\\Foo', $className); + $this->assertEquals('Zfns\\Foo', $loader->getClassName('Foo')); + } } // Call Zend_Loader_PluginLoaderTest::main() if this source file is executed directly. Index: library/Zend/Loader/PluginLoader.php =================================================================== --- library/Zend/Loader/PluginLoader.php (revision 21161) +++ library/Zend/Loader/PluginLoader.php (working copy) @@ -126,6 +126,12 @@ if($prefix == "") { return $prefix; } + + $last = strlen($prefix) - 1; + if ($prefix{$last} == '\\') { + return $prefix; + } + return rtrim($prefix, '_') . '_'; }