No Code Attached Yet bug
avatar drmenzelit
drmenzelit
14 Mar 2023

Steps to reproduce the issue

Create a menu item from type featured articles
Enter -1 (I know it doesn't make sense, but it is possible to do) in leading articles

Expected result

An error message, because a negative number doesn't make sense or at least no problems on the page

Actual result

0 Attempt to modify property "params" on null

grafik

System information (as much as possible)

Joomla 4.2.8
PHP 8.0.4

Additional comments

I checked entering a negative number in the intro articles fields and also with a menu item of type category blog, no errors there.

avatar drmenzelit drmenzelit - open - 14 Mar 2023
avatar joomla-cms-bot joomla-cms-bot - change - 14 Mar 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 14 Mar 2023
avatar brianteeman
brianteeman - comment - 14 Mar 2023

confirmed

avatar chmst chmst - change - 14 Mar 2023
Labels Added: bug
avatar chmst chmst - labeled - 14 Mar 2023
avatar joomdonation
joomdonation - comment - 14 Mar 2023

Someone should review the parameter like this one https://github.com/joomla/joomla-cms/blob/4.2-dev/components/com_content/tmpl/featured/default.xml#L56, add validate rule below to prevent wrong data like this being saved

validate="number"
min="0"
avatar brianteeman
brianteeman - comment - 14 Mar 2023

@joomdonation the weird part is that the field definition is the same in the blog view and it doesnt give tyhe error there

avatar drmenzelit
drmenzelit - comment - 14 Mar 2023

Exactly @brianteeman

avatar joomdonation
joomdonation - comment - 15 Mar 2023

@brianteeman @drmenzelit Because we use different code to getting leading, intro and link items on the two views. For reference

And although there is no fatal error in category blog view, allow negative value for the parameter will cause logical error. For example, if you set Leading Articles parameter to -1, Intro Articles parameter to -3, you will only have 2 intro articles displayed instead of 3 intro articles as expected.

With that said, we should add the suggested validation to prevent this kind of errors.

avatar chmst
chmst - comment - 15 Mar 2023

I agree with @joomdonation that validation of the input is the best. But tried the filter "unit" for that. Please test #40120

avatar joomdonation
joomdonation - comment - 15 Mar 2023

Closing as we have PR #40120 .

avatar joomdonation joomdonation - close - 15 Mar 2023
avatar joomdonation joomdonation - change - 15 Mar 2023
Status New Closed
Closed_Date 0000-00-00 00:00:00 2023-03-15 09:26:27
Closed_By joomdonation

Add a Comment

Login with GitHub to post a comment