RTC bug PR-5.4-dev Pending

User tests: Successful: Unsuccessful:

avatar krishnagandhicode
krishnagandhicode
4 Feb 2026

Pull Request fixes #46708

Summary of Changes

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.

Testing Instructions

  1. Create a Custom Field of type "Calendar"
  2. Create or Edit an Article
  3. In the Calendar field, manually type an invalid date. Use a format that breaks your specific language settings - for eg:
    • For English (Y-m-d): Type 202655-02-04
    • For French/German (d-m-Y): Type 01-01-200566
  4. save.

Actual result BEFORE applying this Pull Request

The site crashes with 0 Call to a member function format() on bool.

Expected result AFTER applying this Pull Request

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!

Link to documentations

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

avatar krishnagandhicode krishnagandhicode - open - 4 Feb 2026
avatar krishnagandhicode krishnagandhicode - change - 4 Feb 2026
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 4 Feb 2026
Category Libraries
avatar krishnagandhicode krishnagandhicode - change - 4 Feb 2026
The description was changed
avatar krishnagandhicode krishnagandhicode - edited - 4 Feb 2026
avatar richard67 richard67 - change - 4 Feb 2026
Title
[5.4] Fix crash in Calendar field with invalid date formmat
[5.4] Fix crash in Calendar field with invalid date format
avatar richard67 richard67 - edited - 4 Feb 2026
avatar richard67
richard67 - comment - 4 Feb 2026

@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.

avatar krishnagandhicode krishnagandhicode - change - 4 Feb 2026
Labels Added: bug PR-5.4-dev
avatar krishnagandhicode
krishnagandhicode - comment - 4 Feb 2026

@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 : )

avatar HLeithner HLeithner - change - 4 Feb 2026
The description was changed
avatar HLeithner HLeithner - edited - 4 Feb 2026
avatar brianteeman
brianteeman - comment - 4 Feb 2026

Note for testers - you don't need to create a custom field. Any calendar field such as start publishing can be used

avatar krishnagandhicode krishnagandhicode - change - 4 Feb 2026
The description was changed
avatar krishnagandhicode krishnagandhicode - edited - 4 Feb 2026
avatar mariantanase
mariantanase - comment - 5 Feb 2026

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).

avatar krishnagandhicode
krishnagandhicode - comment - 5 Feb 2026

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.

avatar mariantanase
mariantanase - comment - 5 Feb 2026

Before applying the patch I've tried with this: 202655-02-04
error-calendar-date-before

After applying the patch, I've tried with the same sample date: 202655-02-04.
The error is different.
error-calendar-date-after

avatar mariantanase
mariantanase - comment - 5 Feb 2026

Now, after applying the patch, the error is:
error-calendar-date-after2

avatar krishnagandhicode krishnagandhicode - change - 5 Feb 2026
The description was changed
avatar krishnagandhicode krishnagandhicode - edited - 5 Feb 2026
avatar krishnagandhicode
krishnagandhicode - comment - 5 Feb 2026

Now, after applying the patch, the error is: error-calendar-date-after2

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.

avatar richard67
richard67 - comment - 5 Feb 2026

@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.

avatar mariantanase mariantanase - test_item - 5 Feb 2026 - Tested successfully
avatar mariantanase
mariantanase - comment - 5 Feb 2026

I have tested this item ✅ successfully on 83b1c50


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

avatar exlemor exlemor - test_item - 5 Feb 2026 - Tested successfully
avatar exlemor
exlemor - comment - 5 Feb 2026

I have tested this item ✅ successfully on 83b1c50

I have successfully tested this @krishnagandhicode.


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46833.
avatar krishnagandhicode
krishnagandhicode - comment - 5 Feb 2026

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 :)

avatar richard67 richard67 - change - 5 Feb 2026
Status Pending Ready to Commit
avatar richard67
richard67 - comment - 5 Feb 2026

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.


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

avatar gioacchino54 gioacchino54 - test_item - 5 Feb 2026 - Tested successfully
avatar gioacchino54
gioacchino54 - comment - 5 Feb 2026

I have tested this item ✅ successfully on 83b1c50

Test before applying the patch
image

An error has occurred.

0 Call to a member function format() on false

Test after applying the patch
image

An error has occurred.

0 0 Invalid field: Calendar


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/46833.
avatar muhme muhme - change - 5 Feb 2026
Labels Added: RTC
avatar muhme
muhme - comment - 5 Feb 2026

✅ Final test before merge using JBT

  • Before PR created custom field birthday exception seen in using year 12026 instead of 2026 Call to a member function format() on false
  • Applied PR with Patch Tester
  • Still POST with 500 Internal Server Error, shown is An error has occurred. 0 Invalid field: birthday, browser back can be used and date with correct format saved
  • Tried wrong date format on 'Start Publishing' and getting Invalid field: Start Publishing
avatar muhme muhme - change - 5 Feb 2026
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
avatar muhme muhme - close - 5 Feb 2026
avatar muhme muhme - merge - 5 Feb 2026
avatar muhme
muhme - comment - 5 Feb 2026

Thank you @krishnagandhicode for your contribution. Thank you @richard67, @Fedik and @brianteeman for your support. Thank you @mariantanase, @exlemor and @gioacchino54 for testing.

Add a Comment

Login with GitHub to post a comment