Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[4.0] current nightly. Saving menu item fails. Call to a member function validate() on bool. Field "show_associations"" #23696

Closed
ReLater opened this issue Jan 27, 2019 · 10 comments

Comments

@ReLater
Copy link
Contributor

ReLater commented Jan 27, 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

@ReLater ReLater changed the 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"" Jan 27, 2019
@ReLater
Copy link
Contributor Author

ReLater commented Jan 27, 2019

Only "Site" menu items.

@joomdonation
Copy link
Contributor

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.

@infograf768
Copy link
Member

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.

@ReLater
Copy link
Contributor Author

ReLater commented Jan 28, 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.

@infograf768
Copy link
Member

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.

@ghazal
Copy link
Contributor

ghazal commented Jan 28, 2019

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

@ReLater
Copy link
Contributor Author

ReLater commented Jan 28, 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.

@infograf768
Copy link
Member

infograf768 commented Jan 28, 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.

@ReLater
Copy link
Contributor Author

ReLater commented Jan 28, 2019

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

@ReLater
Copy link
Contributor Author

ReLater commented Jan 28, 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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants