Problem/Motivation
On PHP 8.4, the following deprecation notice is logged every time a user visits a page that triggers the timezone auto-detection AJAX request (e.g. /user/register with "Users may set their own time zone" enabled):
Deprecated function: timezone_name_from_abbr(): Passing null to parameter #3 ($isDST) of type int is deprecated in Drupal\system\Controller\TimezoneController->getTimezone() (line 49 of web/core/modules/system/src/Controller/TimezoneController.php)
The deprecation does not crash the page, but it fills the database log with noise and will become a fatal error in PHP 9.
Steps to reproduce
Prerequisites
- Install a clean Drupal 11.3.x site using the Standard installation profile, running on PHP 8.4.
Configure the site
- Go to Administration → Configuration → Regional and language → Regional settings (
/admin/config/regional/settings) and set "Users may set their own time zone" to "Users may set their own time zone". Save.
- Go to Administration → Configuration → People → Account settings (
/admin/config/people/accounts) and enable visitor registration under Who can register accounts. Save.
Trigger the bug
- If you are not physically located in India, temporarily change your OS timezone so that
Intl.DateTimeFormat().resolvedOptions().timeZonereturnsAsia/Kolkata(macOS may report this as the legacy aliasAsia/Calcutta— both refer to the same timezone). On macOS: System Settings → General → Date & Time → disable "Set time zone automatically using your current location" → set Closest city to "Kolkata - India". The Time zone field will update to India Standard Time.
This is the key condition: India Standard Time (UTC+5:30) has no Daylight Saving Time, which causestimezone.jsto send an empty string for the DST parameter. Most Western timezones observe DST and send0or1, which matches the route constraint and avoids the bug.
- Open a browser (or a new private window) and visit
/user/register. - Go to Administration → Reports → Recent log messages (
/admin/reports/dblog), filter by type php. The deprecation notice will appear. It is triggered becausetimezone.jssends a request to/system/timezone/0/19800/with an empty last segment for{is_daylight_saving_time}, which does not match the route constraint\-1|0|1, so Symfony falls back to the route defaultNULL. Click the entry to see the full message and stack trace.
Proposed resolution
The cleanest fix is a single-line change in core/modules/system/system.routing.yml: set the default value of is_daylight_saving_time to -1 instead of NULL.
-1 is the documented sentinel value for timezone_name_from_abbr() meaning "do not consider DST". The same pattern is already used for the offset parameter in the same route (offset: -1). Changing the default means the controller always receives a valid int whether the URL segment is present or absent.
system.timezone:
defaults:
offset: -1
- is_daylight_saving_time: NULL
+ is_daylight_saving_time: -1
This also makes core/misc/timezone.js semantically correct without any JS change: the empty string it sends for no-DST timezones falls through to the default, which will now be -1 rather than NULL.
Optional hardening — also fix core/misc/timezone.js to send -1 explicitly instead of '', so the URL segment is always present and valid:
- var isDaylightSavingTime = ''; + var isDaylightSavingTime = -1;
Remaining tasks
- Confirm the fix on Drupal 10.x (likely affected on PHP 8.4 as well)
- Add a regression test
User interface changes
None.
Introduced terminology
None.
API changes
None.
Data model changes
None.
Release notes snippet
None required.
PS: AI was used to review and re-word my original description
| Comment | File | Size | Author |
|---|---|---|---|
| #9 | Screenshot 2026-04-27 at 09.35.53.jpg | 330.9 KB | marcelovani |
| Screenshot 2026-04-17 at 15.05.15.jpg | 266.72 KB | marcelovani | |
| Screenshot 2026-04-17 at 15.04.46.jpg | 227.16 KB | marcelovani | |
| Screenshot 2026-04-17 at 15.24.16.jpg | 71.63 KB | marcelovani |
Issue fork drupal-3585397
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
quietone commentedThe issue summary reads like it was generated using an AI tool. The policy on the use of AI when contributing to Drupal includes that the use of AI must be disclosed. I suggest reading that to be aware of the expectations of the Drupal community and the consequences for violations of the policy.
Issues for Drupal core should be targeted to the 'main' branch, our primary development branch. Changes are made on the main branch first, and are then back ported as needed according to the Core change policies. The version the problem was discovered on should be stated in the issue summary Problem/Motivation section. Thanks.
Comment #3
marcelovaniUpdated the branch. Yes, I used AI to review my personal summary but I think it looks great.
Comment #4
marcelovaniSorry, I read it incorrectly about the version, reverting.
Comment #5
marcelovaniComment #6
ishani patel commentedComment #8
ishani patel commentedHello,
I've raised MR, Kindly review it.
Thank you!
Comment #9
marcelovaniCode looks good, but you need to update the automated tests too.
Ps: I was thinking in ways to test the specific scenario that requires the system to be running in a location that does not have BST, but I am not sure if that is possible to automate.
Comment #10
marcelovaniComment #12
sivaji_ganesh_jojodae commentedI've updated the automated test.
Comment #13
marcelovaniLooks good to me
Comment #14
smustgrave commentedThink this needs more work. TimezoneController::getTimezone() $is_daylight_saving_time defaults to NULL, so should it default to -1
Comment #15
marcelovaniFixed here https://git.drupalcode.org/issue/drupal-3585397/-/commit/e6a7749507f68dd...
Comment #16
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #17
marcelovaniFixed PHPCS issue
Comment #18
smustgrave commentedBelieve feedback for this one has been addressed
Comment #19
alexpottAdded comments to the MR.
Comment #20
marcelovani