mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
allow loading namespaced classes
This permits, e.g. App::uses('Ns\Foo', 'Plugin.Lib'); ... new Ns\Foo(); new \Ns\Foo(); // Or to work
This commit is contained in:
parent
4b8c469004
commit
5bcb1346ab
1 changed files with 3 additions and 1 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue