User tests: Successful: Unsuccessful:
Pull Request for Issue # .
This PR fixes deprecated warning for Calendar form field (use in core which all has translateformat="true"
in it's form field definition). For calendar form field does not have translateformat="true"
, we need a different PR. I think this is safe to go in 4.1 to prevent warnings like this in core.
You would see some deprecated warnings like:
Deprecated: Function strftime() is deprecated in /libraries/src/Form/Field/CalendarField.php on line 277
No deprecated warning anymore, the date time you select for Start Publishing, Finish Start Publishing... are being saved properly.
None
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
I have tested this item
I will see if I can make a pr for 4.1 which will also work for extensions based on this one as I have a bad feeling shipping core for the next months with no way for extension developers to use a core field without a warning on PHP 8.1.
@laoneo All we need to do is add one more line of code to this PR:
$this->filterFormat = (string) $this->element['filterformat'] ? (string) $this->element['filterformat'] : '';
Then extension developers can just add filterformat
attribute with right value to his field and it will work well. It is backward compatible, does not change any existing behavior. It is just if maintainers (especially @bembelimen ) want to accept this change to 4.1.
I don't see this as an issue not to get merged into 4.1 as the benefit is high enough to have a clean way. For 4.2 we can then even deprecate the old format attribute. What I was thinking of is that the name filterformat is a bit strange.
For 4.2 we can then even deprecate the old format attribute
We use that format in calendar javascript code, so it could not be deprecated
What I was thinking of is that the name filterformat is a bit strange
Yes, agree. I guess it is named like that because the format is used in filter method of the field https://github.com/joomla/joomla-cms/blob/4.1-dev/libraries/src/Form/Field/CalendarField.php#L358-L361.
I have tested this item
Deprecated: Function strftime() is deprecated in C:\OpenServer\domains\joomla.test\libraries\src\Form\Field\CalendarField.php on line 285
But I can it reproduce only in custom extension https://github.com/exstreme/Jcomments-4/releases by editing any comment
@exstreme As mentioned, this PR only fixes the issue for calendar form fields use in Joomla core (which has translateformat="true" in the field definition). For calendar form fields use by third party extension, more change is needed, one possible solution could be #37373 (comment) . However, that needs to be a new PR for 4.2. For this PR, I only made small change, not introduce a new thing so that it could be merged into 4.1.
I have tested this item
Status | Pending | ⇒ | Ready to Commit |
Labels |
Added:
?
?
|
RTC
Labels |
Added:
?
PHP 8.x
Removed: ? |
Puh, I see what you did there and it's the most painless solution without rewriting everything I guess but as you stated also not a full solution.
So could you make a remark in the code (or make a deprecation PR for 4.2?), that is has to be changed in the future and create a 5.0 issue (release blocker?) that this has to be fixed.
@bembelimen I also made a PR #37376 for 4.2 which could be the full solution. The purpose of this PR is prevent warnings for Calendar fields use in Joomla core and I think it should be merged for 4.1
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2022-04-20 10:23:02 |
Closed_By | ⇒ | rdeutz |
I would love to see a way, that extensions can define a filter format (not sure why it has that name) in the XML. Can you add that @joomdonation?