Pulled the latest 4.0-dev branch as of July 7, 2018 at 1:53PM PST, going to the frontend and getting this error:
Error: Class 'Joomla\Module\Menu\Site\Helper\MenuHelper' not found: Class 'Joomla\Module\Menu\Site\Helper\MenuHelper' not found
This is a fresh install. Actually this error appeared like 3-4 days but as of the current updates, it has not been fixed.
Labels |
Added:
?
|
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2018-07-07 21:36:13 |
Closed_By | ⇒ | brianteeman |
@brianteeman I already tried #20902 and it doesn't work. Besides the regenerated file autoloader_psr4.php under /libraries/ does not have the class referred above. This issue is in the frontend and not in the administrator as what is in #20902
I have the same issue. I upgraded today from Joomla 3 to Joomla 4. As soon as I enable the menu the following error is displayed: Class "Joomla\Module\Menu\Site\Helper\MenuHelper" not found
I searched for occurrences and found the class under modules/mod_menu/src/Helper/MenuHelper.php. However there are no references in any autoload_psr4.php
there are no references in any autoload_psr4.php
The main namespace is defeined in administrator\cache\autoload_psr4.php
'Joomla\\Module\\Menu\\Site\\' => [JPATH_SITE . '/modules/mod_menu/src'],
Delete the file to force to create it newly-
Then MenuHelper.php
itself defines a namespace:
namespace Joomla\Module\Menu\Site\Helper;
Therefore files like for example mod_menu.php
that want to use the helper have to set a
use Joomla\Module\Menu\Site\Helper\MenuHelper;
Works for me without any issues.
Hm. My entry in the administrator\cache\autoload_psr4.php
is
Joomla\\Module\\Menu\\Site\\' => [JPATH_SITE . '/modules/mod_menu'],
(defined without the folder /src). I deleted it and it is regenerated the file with the same entry and it still doesn't work.
I also checked the folder modules/mod_menu/src/Helper/
and found the file MenuHelper.php
with said namespace.
Any idea why this can be the case?
Any idea why this can be the case?
Nope.
While renewal of this file:
mod_menu.xml
. Is the tag <namespace path="src">Joomla\Module\Menu</namespace>
path
attribute. Is src
.JPATH_SITE . '/modules' . '/' . $extension
.[JPATH_SITE . '/modules/mod_menu/src']
.All paths in administrator\cache\autoload_psr4.php
should have a /src
. Exceptions can be 3rd party extensions.
Ok I understand now what is going on.
The problem is as follows:
In the file libraries/namespacemap.php in the method getNamespaces. There is the following line:
$path = str_replace($isAdministrator ? JPATH_ADMINISTRATOR : JPATH_SITE, '', $namespacePath);
When I output some variables the problem was clear:
namespacePath: /src/modules/mod_menu/src
JPATH_ADMINISTRATOR: /src/administrator
JPATH_SITE: /src
path: /modules/mod_menu
extension: JPATH_SITE . '/modules/mod_menu'
Actually the line should strip the administrator or site prefix. In my case i mapped the code in docker in the directory /src. Thus it will replace the first occurance of /src which is ok but it will also strip the second occurence which leads to my problem.
It would be safer to use a method that only replaces the first occurence or to restrict it to strip the prefix. In my case I can just use another directory.
It would be safer to use a method that only replaces the first occurence or to restrict it to strip the prefix. In my case I can just use another directory.
I think you should open a new issue and describe your last find there because this one here is very old.
Doing a pull won't help as the file doesn't exist in the repo any more. It is built by your site. Just delete the file and let the plugin rebuild it. See #20902