No Code Attached Yet bug
avatar jjnxpct
jjnxpct
27 Jul 2023

Problem identified

We have a cli script that includes some code to use the date helper to format a date. like this:

HTMLHelper::_('date', $uit['ourdate'], 'd F Y'),

The HTML helper does not get a timezone ($tz) value so it is set to default 'true'. Then it tries to get the timezone"

$date->setTimezone($app->getIdentity()->getTimezone());

But this does not seem to work from the frontend context where the cli script is running. Running the same script from the backend does not cause an error. The error is:

 "Call to a member function getTimezone() on null"
message: "Call to a member function getTimezone() on null"
code: 0
file: "./domains/oursite.nl/public_html/libraries/src/HTML/HTMLHelper.php"
line: 873

$app is not set / use properly when run from a CLI script?

Proposed solution

Open questions

Should the helper work OK from a cli script? If yes, is this a bug? If no, how could we get it to work?

avatar jjnxpct jjnxpct - open - 27 Jul 2023
avatar joomla-cms-bot joomla-cms-bot - change - 27 Jul 2023
Labels Added: No Code Attached Yet
avatar joomla-cms-bot joomla-cms-bot - labeled - 27 Jul 2023
avatar chmst chmst - change - 3 Aug 2023
Title
HTML helder date -> not working like expected from cli script?
HTML helper date -> not working like expected from cli script?
avatar chmst chmst - edited - 3 Aug 2023
avatar Hackwar Hackwar - change - 21 Aug 2023
Labels Added: bug
avatar Hackwar Hackwar - labeled - 21 Aug 2023
avatar alikon alikon - change - 4 Feb 2024
Status New Closed
Closed_Date 0000-00-00 00:00:00 2024-02-04 07:48:27
Closed_By alikon
avatar alikon alikon - close - 4 Feb 2024
avatar alikon
alikon - comment - 4 Feb 2024

please test #42754

Add a Comment

Login with GitHub to post a comment