joomla / joomla-cms

Home of the Joomla! Content Management System
https://www.joomla.org
GNU General Public License v2.0
4.77k stars 3.65k forks source link

[4.2.7] - Error Message at creating Admin Menu Item #39758

Closed coolcat-creations closed 2 months ago

coolcat-creations commented 1 year ago

Steps to reproduce the issue

Create an admin menu Create a menu item and click on menu item type

Expected result

A list of menu item types

Actual result

0 strlen(): Argument #1 ($string) must be of type string, array given

System information (as much as possible)

PHP Version 8.0.27 ================== --

0 strlen(): Argument #1 ($string) must be of type string, array given

Call stack
# Function Location
1 () JROOT/administrator/components/com_menus/src/Model/MenutypesModel.php:412
2 strlen()  
3 array_filter() JROOT/administrator/components/com_menus/src/Model/MenutypesModel.php:412
4 Joomla\Component\Menus\Administrator\Model\MenutypesModel->getTypeOptionsFromManifest() JROOT/administrator/components/com_menus/src/Model/MenutypesModel.php:173
5 Joomla\Component\Menus\Administrator\Model\MenutypesModel->getTypeOptionsByComponent() JROOT/administrator/components/com_menus/src/Model/MenutypesModel.php:108

Additional comments

If I comment out Line 412 to 420 in Menu Model it works, /* $o->request = array_filter($request, 'strlen'); $options[] = new CMSObject($o);

             // Do not repeat the default view link (index.php?option=com_abc).
             if (count($o->request) == 1) {
                 $ro = null;
             }*/

print_r for $request is: print_r for request is:

Array ( [option] => com_banners ) Array ( [option] => com_categories [extension] => com_banners ) Array ( [option] => com_banners [view] => clients ) Array ( [option] => com_banners [view] => tracks ) Array ( [option] => com_contact ) Array ( [option] => com_categories [extension] => com_contact ) Array ( [option] => com_easybookreloaded ) Array ( [option] => com_easybookreloaded [view] => gb ) Array ( [option] => com_easybookreloaded [view] => badwords ) Array ( [option] => com_newsfeeds ) Array ( [option] => com_categories [extension] => com_newsfeeds ) Array ( [option] => com_osmap [act] => [task] => [controller] => [view] => sitemaps [layout] => [sub] => ) Array ( [option] => com_plugins [filter] => Array ( [folder] => osmap ) ) Array ( [option] => com_weblinks ) Array ( [option] => com_categories [extension] => com_weblinks ) Array ( [option] => com_fields [view] => fields [context] => com_weblinks.weblink ) Array ( [option] => com_fields [view] => groups [context] => com_weblinks.weblink )

-- could not be reproduced by others.

Hoster is Ionos

chmst commented 1 year ago

I cannot replicate that. What did you before? Disable the admin menu module?

brianteeman commented 1 year ago

Can you replicate this WITHOUT com_easybookreloaded

joomdonation commented 1 year ago

Base on data from print_r command, it could come from osmap. I guess in the extension, there is link with this format

option=com_plugins&filter[folder]=osmap

That link could be used to diplay plugins from osmap plugin group. Joomla could not handle that kind of link for some reasons and it causes the error. Sound like a valid bug.

brianteeman commented 1 year ago

@joomdonation confirmed

coolcat-creations commented 1 year ago

Disabled OS Map and I confirm. Should I close the issue and ask OsMap or should Joomla catch such errors different?

carlitorweb commented 1 year ago

Both imo, without close the issue

richard67 commented 1 year ago

Joomlashack have provided an update for their allediaframework library yesterday, which is also used by and provided with OSMap. Maybe that's related? https://github.com/joomlashack/AllediaFramework/releases/tag/v3.6.6

billtomczak commented 1 year ago

@coolcat-creations has been in touch with us. This is a problem we've been aware of for some time but affected only one other user over the years, so we pretty much ignored it.

OSMap contains a link in the sidebar to a list of plugins filtered by OSMap plugins. This is in the component manifest:

<menu link="option=com_plugins&amp;filter[folder]=osmap">COM_OSMAP_SUBMENU_EXTENSIONS</menu>

This breaks code in Joomla for creating admin menus in both Joomla 3 and Joomla 4. The only thing we can do on our end is remove this convenience link. So future versions of OSMap will remove this convenience link.

Hackwar commented 2 months ago

This has been reported again in #43715 and there I proposed a fix. I'm unable to create a PR myself right now, but please look at that other issue as well to be kept up to date.

alikon commented 2 months ago

please test #43884