?
avatar montellsp
montellsp
29 Jun 2016

The RSS feed for COM_FINDER search throw an Error 500 for all feed type.
(This is an error i had already logged here : https://developer.joomla.org/joomlacode-archive/issue-30167.html)

Steps to reproduce the issue

1 - Set $offset value of configuration.php :

public $offset = 'Europe/Paris';
public $offset_user = 'UTC';

2 - Languages published in the website are : French (default), English.

3 - Set a "menu item alias" for com_finder and name it "search" :

4 - Try to access URL like the example below :
www.mywebsite.com/search?q=Mac&format=feed&type=rss

Expected result

Display of an Atom or RSS feed related to your search term.
This should also work if you have search feed for tags enabled.

Actual result

Error displaying the error page:
Unable to load renderer class: DateTime::__construct():
Failed to parse time string (jeudi 26 décembre 2013) at position 0 (j):
The timezone could not be found in the database

Note : 'jeudi 26 décembre 2013' is the date submitted in French.
English equivalent of : 'Thursday 26 December 2013'

System information (as much as possible)

Joomla version is : 3.5.1

PHP version is : 5.6

In language File for French (fr-FR.ini) you have the values set as below :
(the joomla original value is commented by ";")

; DATE_FORMAT_LC="l j F Y"
DATE_FORMAT_LC="j-m-Y"
; DATE_FORMAT_LC1="l j F Y"
DATE_FORMAT_LC1="j-m-Y"
; DATE_FORMAT_LC2="l j F Y H:i"
DATE_FORMAT_LC2="j-m-Y H:i"
; DATE_FORMAT_LC3="j F Y"
DATE_FORMAT_LC3="j-m-Y"
DATE_FORMAT_LC4="j/m/Y"
DATE_FORMAT_JS1="j/m/y"

Proposal of Solution

The reason of the issue (in my opinion) lies in file <joomla_path>/components/com_finder/views/search/view.feed.php
at line 87. We have a date formated as : JHtml::date($result->start_date, 'l d F Y').
If $result->start_date value does not match format 'l d F Y', the JHtml::date fails.

Given that in feed.php found in <joomla_path>/libraries/joomla/document/feed/feed.php
the type of feeditem date can only be RFC 822, ISO 8601 or Unix Timestamp :

Extract from feed.php :
/**
* Published date
*
* optional
*
* May be in one of the following formats:
*
* RFC 822:
* "Mon, 20 Jan 03 18:05:41 +0400"
* "20 Jan 03 18:05:41 +0000"
*
* ISO 8601:
* "2003-01-20T18:05:41+04:00"
*
* Unix:
* 1043082341
*
* @var string
* @SInCE 11.1
*/

I propose to always set date format as Unix timestamp to stay safe :

To fix this issue, in statement at line 87 from file <joomla_path>/components/com_finder/views/search/view.feed.php, replace the "l d F Y" by "U":

Before :
$item->date = intval($result->start_date) ? JHtml::date($result->start_date, '"l d F Y') : $result->indexdate;

After :
$item->date = intval($result->start_date) ? JHtml::date($result->start_date, 'U') : $result->indexdate;

What do you think ?

Attached is my version of : view.feed.php (renamed as view.feed.php.txt to be allowed for upload)
view.feed.php.txt
And this works on my website : www.anikijournal.com
Example : http://www.anikijournal.com/search?q=OTA&format=feed&type=atom

avatar montellsp montellsp - open - 29 Jun 2016
avatar montellsp montellsp - change - 29 Jun 2016
Title
When RSS feed for COM_FINDER is enabled, feed displayed via menu item alias give Error 500
When RSS feed for COM_FINDER is enabled, feed displayed throw menu item alias give Error 500
avatar montellsp montellsp - change - 29 Jun 2016
Title
When RSS feed for COM_FINDER is enabled, feed displayed throw menu item alias give Error 500
When RSS feed for COM_FINDER is enabled, feed displayed via menu item alias give Error 500
avatar montellsp montellsp - change - 29 Jun 2016
Title
When RSS feed for COM_FINDER is enabled, feed displayed throw menu item alias give Error 500
When RSS feed for COM_FINDER is enabled, feed displayed via menu item alias give Error 500
avatar brianteeman brianteeman - change - 29 Jun 2016
Category Components
avatar brianteeman
brianteeman - comment - 5 Aug 2016

@infograf768 could you take a look at this please as it works fine in english just not in french (assuming I have read this correctly)


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

avatar brianteeman
brianteeman - comment - 11 Aug 2016

Closed as we have a pr for testing #11457

avatar brianteeman brianteeman - change - 11 Aug 2016
Status New Closed
Closed_Date 0000-00-00 00:00:00 2016-08-11 15:30:55
Closed_By brianteeman
avatar brianteeman brianteeman - close - 11 Aug 2016
avatar montellsp
montellsp - comment - 14 Aug 2016

Very good. Thanks a lot for the PR.

avatar brianteeman
brianteeman - comment - 14 Aug 2016

Can you test it please

avatar meditant
meditant - comment - 2 Mar 2018

I have the same thing in joomla 3.8.5 (French configuration) and the same fix work

Best regards,


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

avatar infograf768
infograf768 - comment - 2 Mar 2018

I confirm the issue is still present in 3.8.6RC

Error: Call to undefined method Joomla\CMS\Document\FeedDocument::addHeadLink(): DateTime::__construct(): Failed to parse time string (jeudi 02 novembre 2017) at position 0 (j): The timezone could not be found in the database

The PR stated above has nothing to do with the issue. The one concerned is #11557 which was closed.

avatar infograf768
infograf768 - comment - 2 Mar 2018

Will make a new PR

Add a Comment

Login with GitHub to post a comment