RTC PR-5.2-dev Pending

User tests: Successful: Unsuccessful:

avatar Hackwar
Hackwar
18 Sep 2024

Pull Request for Issue #42790 and a lot more.

Summary of Changes

When using the calendar field without a format and without setting translateformat="true", the field tries to convert the value with strftime(), which is deprecated and throws a warning. This PR replaces strftime() with date() instead and converts the time format from strftime to date-format. To make this as compatible as possible, the conversion method has been extended to include as many conversions as possible. Since this only converts datetimes, the chance that someone is using a format with additional text besides the strftime-format is neglectable.

Testing Instructions

Actual result BEFORE applying this Pull Request

Expected result AFTER applying this Pull Request

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 Hackwar Hackwar - open - 18 Sep 2024
avatar Hackwar Hackwar - change - 18 Sep 2024
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 18 Sep 2024
Category Libraries
avatar ceford
ceford - comment - 19 Sep 2024

Can you give us exact test instructions? I have forgotten what happened previously and I cannot reproduce the error in 5.2.0-beta3-dev.

avatar richard67
richard67 - comment - 19 Sep 2024

Can you give us exact test instructions? I have forgotten what happened previously and I cannot reproduce the error in 5.2.0-beta3-dev.

@ceford Maybe it can be tested as described in PR #43947 ? I haven't tried that yet.

avatar chmst
chmst - comment - 19 Sep 2024

I get the message only with PHP < 8.2. The patch works as described for this field, but did not test with other configurations. and not sure if this is a good solution.

Field definition in my component.

	<field
		name="date_from"
		type="calendar"
		format="%Y-%m-%d"
		showtime="false"
		label="COM_EVENT_DATE_FROM"
		description="COM_EVENT_DATE_FROM_DESC"
	/>

@ceford for a test, change the field definiton in a compoment, for example in com_content, article.xml like this or with all possible different settings:

		<field
			name="created"
			type="calendar"
			label="COM_CONTENT_FIELD_CREATED_LABEL"
		format="%Y-%m-%d"
		showtime="false"
			filter="user_utc"
		/>

and different php versions

avatar aberenguer78
aberenguer78 - comment - 24 Oct 2024

Solution of Chat GPT:
If your current code looks like this using strftime():

php
Copiar código
echo strftime('%Y-%m-%d %H:%M:%S', time());

You can replace it with the DateTime object or the date() function as follows:

php
Copiar código
// Using DateTime object
$date = new DateTime();
echo $date->format('Y-m-d H:i:s');

// Or using the date() function
echo date('Y-m-d H:i:s', time());

avatar aberenguer78
aberenguer78 - comment - 24 Oct 2024

The solution provided I do not consider a proper solution. I don't want to change the configuration of xml manifest field.
You must solve in the code as described before.

avatar aberenguer78
aberenguer78 - comment - 24 Oct 2024

Hi,
sorry for my message I hadn't seen the commit and the changes in code. I have tested in my local joomla web site and it's working fine now, tested succesfully
thanks

avatar fgsw
fgsw - comment - 24 Oct 2024

@aberenguer78 Can you open https://issues.joomla.org/tracker/joomla-cms/44114 and

  • click button "Test this"
  • mark "Tested successfully"

The test will count as successfull.

avatar aberenguer78 aberenguer78 - test_item - 25 Oct 2024 - Tested successfully
avatar aberenguer78
aberenguer78 - comment - 25 Oct 2024

I have tested this item ✅ successfully on bc5ba11

I have replaced the files modified in Joomla core, and the deprecation errors disappear without changing any XML manifest configuration of the component.


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

avatar viocassel viocassel - test_item - 11 Nov 2024 - Tested successfully
avatar viocassel
viocassel - comment - 11 Nov 2024

I have tested this item ✅ successfully on bc5ba11


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

avatar richard67 richard67 - change - 11 Nov 2024
Status Pending Ready to Commit
Labels Added: PR-5.2-dev
avatar richard67
richard67 - comment - 11 Nov 2024

RTC


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

avatar pe7er pe7er - change - 13 Nov 2024
Labels Added: RTC
avatar pe7er pe7er - change - 13 Nov 2024
Status Ready to Commit Fixed in Code Base
Closed_Date 0000-00-00 00:00:00 2024-11-13 16:29:14
Closed_By pe7er
avatar pe7er pe7er - close - 13 Nov 2024
avatar pe7er pe7er - merge - 13 Nov 2024
avatar pe7er
pe7er - comment - 13 Nov 2024

Thanks @Hackwar !

Add a Comment

Login with GitHub to post a comment