J3 Issue ?
avatar ghost
ghost
26 Jun 2018

Is your feature request related to a problem? Please describe.

After upgrading to joomla 3.8.10, I can no longer create or edit a menu item, does anyone know how to solve it?

Describe the solution you'd like

Additional context

avatar rflaraujoweb rflaraujoweb - open - 26 Jun 2018
avatar joomla-cms-bot joomla-cms-bot - change - 26 Jun 2018
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 26 Jun 2018
avatar rflaraujoweb rflaraujoweb - change - 26 Jun 2018
The description was changed
avatar rflaraujoweb rflaraujoweb - edited - 26 Jun 2018
avatar rflaraujoweb rflaraujoweb - change - 26 Jun 2018
Title
Erro create item menu
Erro create item menu joomla 3.8.10
avatar rflaraujoweb rflaraujoweb - edited - 26 Jun 2018
avatar wojsmol
wojsmol - comment - 26 Jun 2018

@rflaraujoweb Do you use any sitemap component?

avatar ghost
ghost - comment - 26 Jun 2018

no

avatar ghost
ghost - comment - 26 Jun 2018

I just updated joomla I'm just using helix 3 and akeebackup

avatar ghost
ghost - comment - 26 Jun 2018

erro: Cannot use object of type stdClass as array

avatar mbabker
mbabker - comment - 26 Jun 2018

Caused by #20313 as noted in #20878

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 26 Jun 2018

@rflaraujoweb Please have a Look at #20878, #20874

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 26 Jun 2018

@rflaraujoweb so i would disable 3rd-Party Plugins one by one and ask help on the forums. This repository concerns in first Place Joomla-Core coding. For this Reason closing this Issue, thanks.

avatar franz-wohlkoenig franz-wohlkoenig - change - 26 Jun 2018
Status New Closed
Closed_Date 0000-00-00 00:00:00 2018-06-26 17:29:14
Closed_By franz-wohlkoenig
avatar joomla-cms-bot joomla-cms-bot - change - 26 Jun 2018
Closed_Date 2018-06-26 17:29:14 2018-06-26 17:29:15
Closed_By franz-wohlkoenig joomla-cms-bot
avatar joomla-cms-bot joomla-cms-bot - close - 26 Jun 2018
avatar joomla-cms-bot
joomla-cms-bot - comment - 26 Jun 2018
avatar mbabker
mbabker - comment - 26 Jun 2018

It is a bug, rather a regression introduced by #20313.

avatar mbabker mbabker - change - 26 Jun 2018
Status Closed New
Closed_Date 2018-06-26 17:29:15
Closed_By joomla-cms-bot
avatar mbabker mbabker - reopen - 26 Jun 2018
avatar dunbarr
dunbarr - comment - 26 Jun 2018

I am having the same problem, I have a basic site no 3rd-party plugins, only what is installed with Joomla. I upgraded to 3.8.9 and the issue began, so I tried upgrading to 3.8.10 to see it that would fix the problem, no dice. Any thoughts?


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20879.

avatar carlitorweb
carlitorweb - comment - 26 Jun 2018

I cant reproduce this in the last staging....

avatar dunbarr
dunbarr - comment - 26 Jun 2018

I found that Helix3 was causing the issue. I disabled Helix3 - Ajax and System - Helix3 Framework and the issue went away.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20879.

avatar carlitorweb
carlitorweb - comment - 26 Jun 2018

Then @mbabker this is not related to the core, right?

avatar mbabker
mbabker - comment - 26 Jun 2018

Again. The root cause is the change in #20313.

You can disable extensions all day and try to play the "this isn't a core problem" game. The regression affects extensions which use the plugin system to hook forms, one of which specifically being the menu item form. Core on its own does not do this, to trigger this regression you MUST have a plugin hooking onContentPrepareData event working with the com_menus.item context.

avatar carlitorweb
carlitorweb - comment - 26 Jun 2018

No, I not like play games. Thank you for the explanation.

avatar franz-wohlkoenig franz-wohlkoenig - change - 26 Jun 2018
Status New Discussion
avatar franz-wohlkoenig franz-wohlkoenig - change - 26 Jun 2018
Category com_menus
avatar ggppdk
ggppdk - comment - 26 Jun 2018

For helix3

Enabling Debug gives

0 Cannot use object of type stdClass as array

Call stack
\# 	Function 	Location
1 	() 	JROOT\plugins\system\helix3\helix3.php:55
2 	plgSystemHelix3->onContentPrepareForm() 	JROOT\libraries\joomla\event\event.php:70
3 	JEvent->update() 	JROOT\libraries\joomla\event\dispatcher.php:160
4 	JEventDispatcher->trigger() 	JROOT\libraries\src\MVC\Model\FormModel.php:321
5 	Joomla\CMS\MVC\Model\FormModel->preprocessForm() 	JROOT\administrator\components\com_menus\models\item.php:1254
6 	MenusModelItem->preprocessForm() 	JROOT\libraries\src\MVC\Model\FormModel.php:242
7 	Joomla\CMS\MVC\Model\FormModel->loadForm() 	JROOT\administrator\components\com_menus\models\item.php:552 
...

Edit file plugins\system\helix3\helix3.php

Add at about line 54
(or better at the beginning of method onContentPrepareForm)
$data = is_object($data) ? (array) $data : $data;

avatar carlitorweb
carlitorweb - comment - 26 Jun 2018

I think this two have related issue #17700 and #20275 (comment)

avatar mbabker
mbabker - comment - 26 Jun 2018

If we had typed Event objects like what the newer 4.0 event dispatching API offers, honestly #20313 would've never passed.

class PrepareDataEvent
{
    public function __construct(string $context, array $data) {}
}

Funny enough, in the cases fixed by #20313 those dispatches wouldn't have worked correctly to begin with because in practice the event signature is this when used anywhere else:

class PrepareDataEvent
{
    public function __construct(string $context, object $data) {}
}

So, it's an awkward as all hell thing to actually address. Because to fix it means reverting #20313 and plugins have to do a lot more work to determine the data type since essentially in practice we've told them "this argument can be either an array or an object, and it's on you to figure out how to work with that data source, oh and you should probably ensure you return the data in the same type it was passed in so you shouldn't arbitrarily cast an array to object and leave it that way". Or, you accept what is essentially a B/C breaking change in the data model for the data passed to this event in these two cases, which only slipped by because we have a loose typed API and no type validation before the event was triggered.

Either way, it's not good.

avatar mbabker
mbabker - comment - 26 Jun 2018

#17700 is totally unrelated.

The issues you've experienced with #20275 are in part the exact issue we're describing here (some code paths are dispatching these plugin events with objects and some with arrays and there's no real consistency).

avatar tonypartridge
tonypartridge - comment - 27 Jun 2018

I really think #20313 should be reversed and new release done quickly then put into J4. It's a big BC break and it's breaking a lot of sites.

avatar mbabker
mbabker - comment - 27 Jun 2018

Someone needs to then document the expected parameter types for the onContentPrepareForm and onContentPrepareData events, with clear documentation on the exceptional cases and how to deal with those differences. Break or not it is also a major inconsistency in the API that requires exceptional handling by extensions and must be clearly documented as such.

avatar tonypartridge
tonypartridge - comment - 27 Jun 2018

And I agree with that @mbabker but it's an incremental release, it should break nothing what so ever. This is what J4 was for so changes like this can be quickly picked up by developers.

avatar mbabker
mbabker - comment - 27 Jun 2018

I'm not turning around to rush out another release. I'm pretty sure there would be a lynch mob at my door if we did a third release in a week (not to mention I really don't feel like working Saturday to make up all the time/pay I'd miss from work this week on releases).

This needs to be thought through and decided on before next release because there are implications either way, and considering extensions are making changes and releases because of it a flat out revert creates even more headaches for them at this point. I'm not arguing in favor of either stance at this point, both have their merits, but both have their baggage that needs to be weighed.

avatar tonypartridge
tonypartridge - comment - 27 Jun 2018

In which case I suppose that’s the answer, there is no point in fixing it later since developers will already be adapting their extensions to try and work with both arrays and objects. It’s just the native outpour we will be having because peoples sites are going down on an incremental release.

I thought changing an array to an object was against Symver because it’s a structural change.

On 27 Jun 2018, 14:30 +0100, Michael Babker notifications@github.com, wrote:

I'm not turning around to rush out another release. I'm pretty sure there would be a lynch mob at my door if we did a third release in a week (not to mention I really don't feel like working Saturday to make up all the time/pay I'd miss from work this week on releases).
This needs to be thought through and decided on before next release because there are implications either way, and considering extensions are making changes and releases because of it a flat out revert creates even more headaches for them at this point. I'm not arguing in favor of either stance at this point, both have their merits, but both have their baggage that needs to be weighed.

You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

avatar mbabker
mbabker - comment - 27 Jun 2018

Had I realized that before I would've said something. Hindsight is 20/20.

To counter that though is the argument that these cases were inconsistent and in a strictly typed API the inconsistent cases would've raised errors on their own (see my earlier comment on this thread). So from a strictly PHP perspective, if we had said typed API and changed method signatures to remove the type declaration on the $data param that too is a B/C break in PHP 7.1 and earlier (7.2 allows this type of contravariance). That's why it's a lot more involved IMO than simply reverting the PR.

avatar 2of7
2of7 - comment - 3 Jul 2018

I have just updated and I also receive the error reported on this post, if I try to modify / create a new menu item. But if I try to activate debugging I always have an "HTTP ERROR 500", how can I get more details?

avatar wojsmol
wojsmol - comment - 3 Jul 2018

@2of7 Please create new topic in Migrating and Upgrading to Joomla! 3.x forum and run Forum Post Assistant and include results in first post.

avatar tonypartridge
tonypartridge - comment - 3 Jul 2018

It’ll be a BC issue, make sure all plugins are up to date. Hopefully the developers of the plugin causing the issue have done it for you.

Many thanks

--
Tony Partridge
On 3 Jul 2018, 15:28 +0100, Wojciech Smoliński notifications@github.com, wrote:

@2of7 Please create new topic in Migrating and Upgrading to Joomla! 3.x forum and run Forum Post Assistant and include results in first post.

You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.

avatar brianteeman brianteeman - change - 2 Aug 2018
Labels Added: J3 Issue
avatar brianteeman brianteeman - labeled - 2 Aug 2018
avatar Parahot
Parahot - comment - 24 Sep 2018

Thank you, this comment helped to solve the problem:
https://issues.joomla.org/tracker/joomla-cms/20879#event-369023


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/20879.

avatar PolymathWhiz
PolymathWhiz - comment - 9 Oct 2018

For helix3

Enabling Debug gives

0 Cannot use object of type stdClass as array

Call stack
\# 	Function 	Location
1 	() 	JROOT\plugins\system\helix3\helix3.php:55
2 	plgSystemHelix3->onContentPrepareForm() 	JROOT\libraries\joomla\event\event.php:70
3 	JEvent->update() 	JROOT\libraries\joomla\event\dispatcher.php:160
4 	JEventDispatcher->trigger() 	JROOT\libraries\src\MVC\Model\FormModel.php:321
5 	Joomla\CMS\MVC\Model\FormModel->preprocessForm() 	JROOT\administrator\components\com_menus\models\item.php:1254
6 	MenusModelItem->preprocessForm() 	JROOT\libraries\src\MVC\Model\FormModel.php:242
7 	Joomla\CMS\MVC\Model\FormModel->loadForm() 	JROOT\administrator\components\com_menus\models\item.php:552 
...

Edit file plugins\system\helix3\helix3.php

Add at about line 54
(or better at the beginning of method onContentPrepareForm)
$data = is_object($data) ? (array) $data : $data;

Awesome!!

avatar franz-wohlkoenig franz-wohlkoenig - edited - 19 Apr 2019
avatar franz-wohlkoenig franz-wohlkoenig - change - 19 Apr 2019
Title
Erro create item menu joomla 3.8.10
Erro create item menu
avatar Quy
Quy - comment - 10 Jun 2019

Can this be closed?

avatar franz-wohlkoenig
franz-wohlkoenig - comment - 10 Jun 2019

Closed, please reopen if needed.

avatar franz-wohlkoenig franz-wohlkoenig - change - 10 Jun 2019
Status Discussion Closed
Closed_Date 0000-00-00 00:00:00 2019-06-10 17:35:21
Closed_By franz-wohlkoenig
avatar franz-wohlkoenig franz-wohlkoenig - close - 10 Jun 2019

Add a Comment

Login with GitHub to post a comment