J4 Issue ?
avatar joomdonation
joomdonation
12 Dec 2018

Steps to reproduce the issue

  1. Install Joomla 4 nightly build
  2. Try to create a menu item

Expected result

Menu item created

Actual result

An error has occurred.
0 Too few arguments to function PlgContentJoomla::onContentBeforeSave(), 3 passed in D:\www\joomla4\libraries\src\Plugin\CMSPlugin.php on line 287 and exactly 4 expected

System information (as much as possible)

Joomla 4 nightly build

Additional comments

This can be easily fixed by modifying code on this line https://github.com/joomla/joomla-cms/blob/staging/administrator/components/com_menus/models/item.php#L1430 and add $data variable to the event trigger. However, there would be many other places which we need to check and also, it would cause same errors with third party extension. So maybe we can make $data parameter optional in this method onContentBeforeSave https://github.com/joomla/joomla-cms/blob/4.0-dev/plugins/content/joomla/joomla.php#L55

avatar joomdonation joomdonation - open - 12 Dec 2018
avatar joomla-cms-bot joomla-cms-bot - change - 12 Dec 2018
Labels Added: ?
avatar joomla-cms-bot joomla-cms-bot - labeled - 12 Dec 2018
avatar infograf768
infograf768 - comment - 16 Dec 2018

I confirm the issue, not only create but also saving an existing menu item.

avatar infograf768
infograf768 - comment - 16 Dec 2018

I like better your second solution, something like
public function onContentBeforeSave($context, $table, $isNew, $data = '')

avatar infograf768 infograf768 - change - 17 Dec 2018
Labels Added: J4 Issue
avatar infograf768 infograf768 - labeled - 17 Dec 2018
avatar Ninja-007
Ninja-007 - comment - 23 Dec 2018

I have encountered issue on 21st Dec nightly build. As of now, I am using the workaround suggested above public function onContentBeforeSave($context, $table, $isNew, $data = '').

avatar ReLater
ReLater - comment - 30 Dec 2018

Please test pr #23395

avatar joomdonation
joomdonation - comment - 30 Dec 2018

The bug was fixed on #23355 (and the decision was keep $data as required parameter in the method). So your PR should be closed, too

avatar joomdonation joomdonation - change - 30 Dec 2018
Status New Closed
Closed_Date 0000-00-00 00:00:00 2018-12-30 16:25:40
Closed_By joomdonation
avatar joomdonation joomdonation - close - 30 Dec 2018
avatar ReLater
ReLater - comment - 31 Dec 2018

@joomdonation
I use a J!4 where 23355 is already merged. So, I see no reason to close my PR at the moment.

avatar joomdonation
joomdonation - comment - 31 Dec 2018

OK. Just for information, you can see @wilsonge comment about it at #23293 (comment) ($data is required, not optional as proposed in your PR)

Add a Comment

Login with GitHub to post a comment