? ? Failure

User tests: Successful: Unsuccessful:

avatar marcorensch
marcorensch
16 Jan 2021

Pull Request for Issue # .

Summary of Changes

The database query with relative date fails because the $nowDate is not 'quoted'.

Testing Instructions

Create new module instance of mod_articles_category and set filter to relative date.

Actual result BEFORE applying this Pull Request

The Query fails and the frontend shows an error:

Warning: Invalid argument supplied for foreach() in /Users/marcorensch/Sites/joomla4b5/components/com_content/src/Model/ArticlesModel.php on line 713

Warning: Invalid argument supplied for foreach() in /Users/marcorensch/Sites/joomla4b5/modules/mod_articles_category/src/Helper/ArticlesCategoryHelper.php on line 257

Expected result AFTER applying this Pull Request

The query runs and the searched articles gets loaded.

Documentation Changes Required

The $nowDate was already quoted in Joomla 3.x, but was not initially set in J4 because in line 298/299 /378/379/538/539 $nowDate is used with bind which does not have to be 'quoted'. The easiest & cleanest way is to 'quote' $nowDate directly in the relative query.

avatar marcorensch marcorensch - open - 16 Jan 2021
avatar marcorensch marcorensch - change - 16 Jan 2021
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 16 Jan 2021
Category Front End com_content
avatar marcorensch marcorensch - change - 16 Jan 2021
Labels Added: ?
avatar richard67
richard67 - comment - 17 Jan 2021

@HLeithner The prepared statements did not work with these relative date statements, that's why @SharkyKZ has suggested to revert that, and I think he is right.

avatar HLeithner
HLeithner - comment - 17 Jan 2021

@HLeithner The prepared statements did not work with these relative date statements, that's why @SharkyKZ has suggested to revert that, and I think he is right.

Already thought this... should be commented...

avatar ChristineWk
ChristineWk - comment - 17 Jan 2021

Set Date Filtering to Relative Date. Before Patch: Confirm Actual Result (Warnings)
Enabled Patch: Warning has gone off, but the module mod_articles_category is not visible in frontend.
Joomla 4.0.0-beta7-dev


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

avatar chmst chmst - test_item - 17 Jan 2021 - Tested successfully
avatar chmst
chmst - comment - 17 Jan 2021

I have tested this item successfully on ee5574f

Tested successfully.

@ChristineWk - maybe none of your articles met the filter?


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

avatar ChristineWk
ChristineWk - comment - 17 Jan 2021

@chmst
I'm not sure :-) but have enough articles:

screen shot 2021-01-17 at 18 00 21
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/32064.

avatar ChristineWk ChristineWk - test_item - 17 Jan 2021 - Tested successfully
avatar ChristineWk
ChristineWk - comment - 17 Jan 2021

I have tested this item successfully on ee5574f

Solution: I had wrong filter date.


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

avatar richard67 richard67 - test_item - 17 Jan 2021 - Tested successfully
avatar richard67
richard67 - comment - 17 Jan 2021

I have tested this item successfully on ee5574f

Tested with MySQL and PostgreSQL.


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

avatar richard67 richard67 - change - 17 Jan 2021
Status Pending Ready to Commit
avatar richard67
richard67 - comment - 17 Jan 2021

RTC


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

avatar infograf768 infograf768 - change - 18 Jan 2021
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2021-01-18 14:32:49
Closed_By infograf768
Labels Added: ?
avatar infograf768 infograf768 - close - 18 Jan 2021
avatar infograf768 infograf768 - merge - 18 Jan 2021
avatar infograf768
infograf768 - comment - 18 Jan 2021

Tks.

Add a Comment

Login with GitHub to post a comment