? Pending

User tests: Successful: Unsuccessful:

avatar Hackwar
Hackwar
17 Dec 2018

Opening the menu manager right now in 4.0-dev throws a SQL query error. This PR fixes that. Saveing a menu item also results in a PHP error because the data array is missing in the onBeforeContentSave event. This also fixes that. With that, installing sample data is also again possible. So: Happy merging! ?

Votes

# of Users Experiencing Issue
1/1
Average Importance Score
5.00

avatar Hackwar Hackwar - open - 17 Dec 2018
avatar Hackwar Hackwar - change - 17 Dec 2018
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 17 Dec 2018
Category Administration com_menus
avatar infograf768
infograf768 - comment - 17 Dec 2018

see discussion here:
#23276

avatar rdeutz
rdeutz - comment - 17 Dec 2018

@SniperSister @zero-24 seems to me a false positive

avatar SharkyKZ
SharkyKZ - comment - 18 Dec 2018

The second issue should be fixed in the plugin by declaring default $data value:

public function onContentBeforeSave($context, $table, $isNew, $data)

avatar infograf768
infograf768 - comment - 18 Dec 2018

This is what I proposed here
https://github.com/joomla/joomla-cms/issues/23276#issuecomment-447659297

avatar joomdonation
joomdonation - comment - 18 Dec 2018

@infograf768 Except that $data should have default value set to an empty array instead of empty string as you proposed.

Personal, I would like to see the validated $data available in the event handler so that in case plugin needs input data, it can get it directly from $data array instead of having to get it from application input. We pass that data for saving article already, and should do the same for other items in the core (of course in a different PR). So to me, this PR is good as it is.

For some reasons, I could not see error with menus manager, and could not mark the test as success (maybe Joomla 4 installation is few days outdated)

avatar Hackwar
Hackwar - comment - 18 Dec 2018

The problem is, that the event is used with the $data and that that has been released into the wild. At the same time, $data is missing from the documentation, so... Either we drop the $data completely or we make it mandatory. I'm voting for mandatory.

avatar joomdonation
joomdonation - comment - 18 Dec 2018

I would vote for mandatory, too, just worry that it will make third party extensions broken.

avatar Hackwar
Hackwar - comment - 18 Dec 2018

Yes and no. It wouldn't break third party extensions, since they simply get one more parameter, which they ignore. But that wouldn't really matter, since we can break stuff for 4.0.

avatar joomdonation
joomdonation - comment - 18 Dec 2018

It would break third party extensions if they implement custom save method in their model (same with how our menu item model which you fix issue on this PR). But Yes, I vote for it mandatory, too.

avatar wilsonge
wilsonge - comment - 26 Dec 2018

@Hackwar can you remove the sql query modification. That's going to be fixed at root cause in #23344 and avoids the comment mentioned by @csthomas here.

RE: Data parameter was added in #13638 . I've now documented it as required https://docs.joomla.org/Plugin/Events/Content#onContentBeforeSave - it shouldn't affect that many people as it's been default in the base model to send this since 3.7 and will be fully supported in j3 if people do it

avatar wojsmol
wojsmol - comment - 27 Dec 2018

Tested successfully when only administrator/components/com_menus/Model/ItemModel.php chenge is applied.

avatar wilsonge
wilsonge - comment - 27 Dec 2018

Ported out the sample data fix in #23355 - closing as both fixes have now been merged

avatar wilsonge wilsonge - close - 27 Dec 2018
avatar wilsonge wilsonge - change - 27 Dec 2018
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2018-12-27 17:38:00
Closed_By wilsonge
Labels Added: ?
avatar Scrabble96
Scrabble96 - comment - 1 Jan 2019

Not sure why this issue is closed. The issue still stands: When clicking on Menus > Main Menu in Alpha 6 I get this message:

"An error has occurred.
500 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.published,a.component_id,a.checked_out,a.checked_out_time,a.`br' at line 1"

avatar wojsmol
wojsmol - comment - 1 Jan 2019

@Scrabble96 Please test on latest 4.0 nightly build.

avatar Scrabble96
Scrabble96 - comment - 1 Jan 2019

Thank you, @wojsmol
I've updated to the latest nightly build and it does indeed work now. I'll know to use that link to updates in future.

avatar wilsonge
wilsonge - comment - 1 Jan 2019

@Scrabble96 just as an FYI the nightly is the current state of development - the roughly monthly alpha's are fixed releases

avatar Scrabble96
Scrabble96 - comment - 2 Jan 2019

Thanks, @wilsonge
I was really querying why this was closed because it was merged with another ticket and marked as 'fixed' (#23355) on 27th. I thought from reading that, that it would have gone into the latest fixed release (Alpha 6) which was released on 28th. Too close, I guess.

Add a Comment

Login with GitHub to post a comment