User tests: Successful: Unsuccessful:
Pull Request fixes #46708
This PR fixes a fatal error (Call to a member function format() on bool) that occurs when a Calendar field receives an invalid date format.
Previously, CalendarField::filter() did not check if DateTime::createFromFormat() failed (returned false), leading to a crash when calling ->format() when the result is boolean.
202655-02-0401-01-200566The site crashes with 0 Call to a member function format() on bool.
The site displays a Error Page (Exception) with a clear message identifying the specific field:
"An error has occurred. 0 Invalid field: Start Publishing" (or the label of the specific field being tested, e.g: "Invalid field: Created Date").
The save is blocked, and the page reloads gracefully.
A specific error message appears identifying the broken field: "Invalid field: Start Publishing" (or the label of your custom field).
Note: I am relatively new to contributing to the core codebase, I am very open to feedback, If there is a preferred way to handle the translation keys or validation logic, I would appreciate your guidance!
Please select:
Documentation link for guide.joomla.org:
No documentation changes for guide.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
| Status | New | ⇒ | Pending |
| Category | ⇒ | Libraries |
| Title |
|
||||||
| Labels |
Added:
bug
PR-5.4-dev
|
||
@krishnagandhicode Please fix the code style errors reported here: https://github.com/joomla/joomla-cms/actions/runs/21680625878/job/62514601493?pr=46833
First of all use spaces and not tabs for indentation.
Thanks, on it : )
Note for testers - you don't need to create a custom field. Any calendar field such as start publishing can be used
I cannot reproduce the issue.
On "Start publishing" field I type 05-02-2026 (d-m-Y).
When I click save, the article is saved without errors, but the date is changed to 2010-08-19 00:00:00
P.S. I did not create a custom field (as suggested by Brian).
I cannot reproduce the issue. On "Start publishing" field I type 05-02-2026 (d-m-Y). When I click save, the article is saved without errors, but the date is changed to 2010-08-19 00:00:00
P.S. I did not create a custom field (as suggested by Brian).
@mariantanase Thanks for testing.
To reproduce the Fatal Error (Crash), please try this:- Enter: 202655-02-04 (Year 202655)
That should trigger the fatal exception we are trying to fix.
Thanks for the re-test, @mariantanase!
yes, that is the intended behavior now - it correctly identifies the specific field label in the exception message.
also I have updated the PR description to match this result for better clarity.
@mariantanase So your test result looks like a successful test to me. If you agree, please go to this PR in the issue tracker here https://issues.joomla.org/tracker/joomla-cms/46833 and use the blue "Test this" button at the top left corner to submit your test result. Thanks in advance, and thanks for testing.
I have tested this item ✅ successfully on 83b1c50
I have tested this item ✅ successfully on 83b1c50
I have successfully tested this @krishnagandhicode.
I have tested this item ✅ successfully on 83b1c50I have successfully tested this @krishnagandhicode.
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46833.
Thanks Emmanuel :)
| Status | Pending | ⇒ | Ready to Commit |
RTC - This PR is ok as bug fix in 5.4-dev as it does not change behaviour, only improves the error message.
But further improvements in future versions (6.x) might be useful. Or we remove the calendar field and use a generic one on the long run.
I have tested this item ✅ successfully on 83b1c50
Test before applying the patch

0 Call to a member function format() on false
0 0 Invalid field: Calendar
| Labels |
Added:
RTC
|
||
✅ Final test before merge using JBT
birthday exception seen in using year 12026 instead of 2026 Call to a member function format() on falseAn error has occurred. 0 Invalid field: birthday, browser back can be used and date with correct format savedInvalid field: Start Publishing| Status | Ready to Commit | ⇒ | Fixed in Code Base |
| Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2026-02-05 18:11:57 |
| Closed_By | ⇒ | muhme |
Thank you @krishnagandhicode for your contribution. Thank you @richard67, @Fedik and @brianteeman for your support. Thank you @mariantanase, @exlemor and @gioacchino54 for testing.
@krishnagandhicode Please fix the code style errors reported here: https://github.com/joomla/joomla-cms/actions/runs/21680625878/job/62514601493?pr=46833
First of all use spaces and not tabs for indentation.