From 5bcb1346ab9101c9ef7e53cbb9c6a73105a5e1bb Mon Sep 17 00:00:00 2001 From: AD7six Date: Sun, 27 May 2012 19:18:14 +0200 Subject: [PATCH] allow loading namespaced classes This permits, e.g. App::uses('Ns\Foo', 'Plugin.Lib'); ... new Ns\Foo(); new \Ns\Foo(); // Or to work --- lib/Cake/Core/App.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/Cake/Core/App.php b/lib/Cake/Core/App.php index 5a1c646db..7619bef6a 100644 --- a/lib/Cake/Core/App.php +++ b/lib/Cake/Core/App.php @@ -551,8 +551,10 @@ class App { $paths[] = $pluginPath . 'Lib' . DS . $package . DS; $paths[] = $pluginPath . $package . DS; } + + $normalizedClassName = str_replace('\\', DS, $className); foreach ($paths as $path) { - $file = $path . $className . '.php'; + $file = $path . $normalizedClassName . '.php'; if (file_exists($file)) { self::_map($file, $className, $plugin); return include $file;