JLoader::registerNamespace('B', JPATH_SITE . '/libraries/app/vendor/B/src', $reset = true, $prepend = false, $type = 'psr4');
\B\B::anyMethod();
Autoloading \B\B class and calling anyMethod.
Class not found.
File: libraries/loader.php
if (strpos($class, $ns) === 0)
is not enough, there can be two namespaces AAA and AAAB, both starting with 'AAA'. Valid check is:$nsLen = strlen($ns);
if (strpos($class, $ns) === 0 && isset($class[$nsLen]) && $class[$nsLen] === DIRECTORY_SEPARATOR)
$classFilePath = $path . DIRECTORY_SEPARATOR . str_replace($nsPath, '', $classPath);
Valid behavior is to strip only leading namespace part:
$classFilePath = $path . DIRECTORY_SEPARATOR . substr($classPath, $nsLen + 1);
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-07-17 18:12:14 |
Closed_By | ⇒ | zero-24 |
Guess this one can be closed as we have a pr.