?
avatar ReLater
ReLater
27 Jan 2019

Steps to reproduce the issue

  • Nightly of today (Sunday, 27 January 2019 03:00:17 UTC)
  • Try to save a menu item => Error "0 Call to a member function validate() on bool "

Call stack

| Function | Location

1 | () | JROOT/libraries/src/Form/Form.php:1202
2 | Joomla\CMS\Form\Form->validate() | JROOT/libraries/src/MVC/Model/FormModel.php:199
3 | Joomla\CMS\MVC\Model\FormModel->validate() | JROOT/administrator/components/com_menus/Controller/ItemController.php:368
4 | Joomla\Component\Menus\Administrator\Controller\ItemController->save() | JROOT/libraries/src/MVC/Controller/BaseController.php:736
5 | Joomla\CMS\MVC\Controller\BaseController->execute() | JROOT/libraries/src/Dispatcher/ComponentDispatcher.php:146
6 | Joomla\CMS\Dispatcher\ComponentDispatcher->dispatch() | JROOT/libraries/src/Component/ComponentHelper.php:379
7 | Joomla\CMS\Component\ComponentHelper::renderComponent() | JROOT/libraries/src/Application/AdministratorApplication.php:116
8 | Joomla\CMS\Application\AdministratorApplication->dispatch() | JROOT/libraries/src/Application/AdministratorApplication.php:159
9 | Joomla\CMS\Application\AdministratorApplication->doExecute() | JROOT/libraries/src/Application/CMSApplication.php:232
10 | Joomla\CMS\Application\CMSApplication->execute() | JROOT/administrator/includes/app.php:63
11 | require_once() | JROOT/administrator/index.php:36

System information (as much as possible)

  • PHP 7.2, PHP 7.3

Additional comments

It looks like method loadField() (https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/src/Form/Form.php#L1560) returns false for field show_associations

avatar ReLater ReLater - open - 27 Jan 2019
avatar joomla-cms-bot joomla-cms-bot - change - 27 Jan 2019
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 27 Jan 2019
avatar ReLater ReLater - change - 27 Jan 2019
Title
[4.0] current nightly. Saving menu item fails. Call to a member function validate() on bool
[4.0] current nightly. Saving menu item fails. Call to a member function validate() on bool. Field "show_associations""
avatar ReLater ReLater - edited - 27 Jan 2019
avatar ReLater
ReLater - comment - 27 Jan 2019

Only "Site" menu items.

avatar ReLater ReLater - change - 27 Jan 2019
The description was changed
avatar ReLater ReLater - edited - 27 Jan 2019
avatar joomdonation
joomdonation - comment - 28 Jan 2019

If someone wants to look at it, I think we can use similar solution on this PR #23501. Maybe we should search for all show_associations field in all components and fix it.

avatar infograf768
infograf768 - comment - 28 Jan 2019

4.0-dev branch (NOT nightly)

I can't reproduce the issue here on non-multilingual site.
I also can't reproduce the issue on a multilingual site, associations set to Yes or NO in the language filter.

avatar ReLater
ReLater - comment - 28 Jan 2019

The issue has been reported in a german forum and I tested it afterwards and could confirm it with an updated older J4 version and a new online installation.

I've installed now the nightly build of today (Monday, 28 January 2019 03:00:50 UTC) from scratch on XAMPP727 without any additional steps, opened menu item "Home" in back-end, clicked on Save and have still the same issue.

This line https://github.com/joomla/joomla-cms/blob/4.0-dev/libraries/src/Form/Form.php#L1200 results in a $fieldObj === false when field show_associations is processed.

avatar infograf768
infograf768 - comment - 28 Jan 2019

Hmm
I did a clean install of the dev branch and I confirm the error:
Call to a member function validate() on boolean

This happens when it is a menu item chosen from the Articles menu items.

This happens whether show_associations is set or not in Articles Component config.
Can't confirm if show_associations is the culprit.

avatar ghazal
ghazal - comment - 28 Jan 2019

Issue confirmed.
Nightly Build of Monday, 28 January 2019.

avatar ReLater
ReLater - comment - 28 Jan 2019

@joomdonation
I can confirm that adding lines

// Remove show_associations field if associations is not enabled
if (!Associations::isEnabled())
{
 $form->removeField('show_associations', 'params');
}

before return $form; in administrator\components\com_menus\Model\ItemModel.php

solves the issue. Tested in back-end only.

I'll create a pr.

avatar infograf768
infograf768 - comment - 28 Jan 2019

@ReLater
Something weird.
Your proposal does work fine. But, here, after I undo your patch, all is fine again.

EDIT: Session issue, no worry.

avatar ReLater
ReLater - comment - 28 Jan 2019

@infograf768
I applied the patch 23700 with Joomla Patch Tester. When I "Revert Patch" then I have the same issue lkike before.

avatar ReLater ReLater - change - 28 Jan 2019
Status New Closed
Closed_Date 0000-00-00 00:00:00 2019-01-28 13:16:17
Closed_By ReLater
avatar ReLater
ReLater - comment - 28 Jan 2019

Test pr #23716 instead of 23700 !

There's a pr now that works with Joomla core: #23700

So I'm closing here but not happy. See concerns in #23700 (comment) and #23700 (comment)

avatar ReLater ReLater - close - 28 Jan 2019

Add a Comment

Login with GitHub to post a comment