bug PR-4.4-dev Pending

User tests: Successful: Unsuccessful:

avatar alikon
alikon
4 Feb 2024

Pull Request for Issue #41263 .

Summary of Changes

default to server tz if no user tz

Testing Instructions

edit your libraries/src/Console/ListUserCommand.php
use Joomla\CMS\HTML\HTMLHelper;
https://github.com/joomla/joomla-cms/blob/4.4-dev/libraries/src/Console/ListUserCommand.php#L18
and this line
$a=HTMLHelper::_('date', 'now', 'd F Y');

https://github.com/joomla/joomla-cms/blob/4.4-dev/libraries/src/Console/ListUserCommand.php#L108

run cli\joomla.php user:list

Actual result BEFORE applying this Pull Request

Call to a member function getTimezone() on null

Expected result AFTER applying this Pull Request

no error

Link to documentations

Please select:

  • Documentation link for docs.joomla.org:

  • No documentation changes for docs.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

avatar alikon alikon - open - 4 Feb 2024
avatar alikon alikon - change - 4 Feb 2024
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 4 Feb 2024
Category Libraries
avatar alikon alikon - change - 4 Feb 2024
Title
defaulttoservertz
[4][cli] - HTMLHelper timezone
avatar alikon alikon - edited - 4 Feb 2024
avatar Quy Quy - test_item - 16 Feb 2024 - Tested successfully
avatar Quy Quy - test_item - 16 Feb 2024 - Tested successfully
avatar Quy
Quy - comment - 16 Feb 2024

Change it to the following. then there is no need to add the check.
$a=HTMLHelper::_('date', 'now', 'd F Y', false);

avatar ceford ceford - test_item - 26 Feb 2024 - Tested successfully
avatar ceford
ceford - comment - 26 Feb 2024

I have tested this item ✅ successfully on c907c1e


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

avatar richard67
richard67 - comment - 26 Feb 2024

@Quy The issue tracker shows a successful human test result from you, but here on GitHub I can't see that. Have you tested this PR? Or is something wrong with it? Does your comment above mean the PR is not necessary?

avatar Quy Quy - alter_testresult - 26 Feb 2024 - Quy: Not tested
avatar joomdonation
joomdonation - comment - 26 Feb 2024

I don't think this is a right fix and should be closed. We have to respect the value of argument passed to the method call, not changing under certain condition like this (if someone pass true to the method call, why do we change it to false) ?

Back to the original issue, I think people should not use HTMLHelper methods on a CLI script (isn't this class name show that we should only uses it on Html context ?) ? If someone wants to format a date like that, better create a date object and call format mehod instead (I don't check the timezone parameter here, just show the idea)

$date = Factory::getDate();
$date->format('d F Y');
avatar alikon alikon - change - 26 Feb 2024
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2024-02-26 18:20:52
Closed_By alikon
Labels Added: bug PR-4.4-dev
avatar alikon
alikon - comment - 26 Feb 2024

I think people should not use HTMLHelper methods on a CLI script

fully agree

avatar alikon alikon - close - 26 Feb 2024

Add a Comment

Login with GitHub to post a comment