[PR #121] [CLOSED] Suppress warnings on date_default_timezone_get() #944

Closed
opened 2026-03-04 03:03:06 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Seldaek/monolog/pull/121
Author: @dcousineau
Created: 9/27/2012
Status: Closed

Base: masterHead: fix-default-timezone-warning


📝 Commits (1)

  • 64b9651 Suppress warnings on date_default_timezone_get()

📊 Changes

1 file changed (+1 additions, -1 deletions)

View changed files

📝 src/Monolog/Logger.php (+1 -1)

📄 Description

Unfortunately date_default_timezone_get() still triggers the classic timezone warning, and there is no other way to determine if a timezone has been set.

While one can ensure their projects always perform a date_default_timezone_set() there are still common places where monolog can be imported without direct user control over setting default timezones.

In my particular case, including monolog in a Symfony2 composer project with the stock Symfony2 post-install-cmd and post-update-cmd chain causes failures at the end of an install/update cycle. I believe it's composer in this case that translates all triggered warnings/errors into exceptions which causes whatever process that is running to fail.

Therefore I propose we just suppress the warnings from date_default_timezone_set() for now.

In the future timezone management should maybe be mildly refactored to be injectable and default to UTC, but this will eliminate


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Seldaek/monolog/pull/121 **Author:** [@dcousineau](https://github.com/dcousineau) **Created:** 9/27/2012 **Status:** ❌ Closed **Base:** `master` ← **Head:** `fix-default-timezone-warning` --- ### 📝 Commits (1) - [`64b9651`](https://github.com/Seldaek/monolog/commit/64b9651abe4afa18d91e5d31670e1470a32cf60f) Suppress warnings on date_default_timezone_get() ### 📊 Changes **1 file changed** (+1 additions, -1 deletions) <details> <summary>View changed files</summary> 📝 `src/Monolog/Logger.php` (+1 -1) </details> ### 📄 Description Unfortunately `date_default_timezone_get()` still triggers the classic timezone warning, and there is no other way to determine if a timezone has been set. While one can ensure their projects always perform a `date_default_timezone_set()` there are still common places where monolog can be imported without direct user control over setting default timezones. In my particular case, including monolog in a Symfony2 composer project with the stock Symfony2 `post-install-cmd` and `post-update-cmd` chain causes failures at the end of an install/update cycle. I believe it's composer in this case that translates all triggered warnings/errors into exceptions which causes whatever process that is running to fail. Therefore I propose we just suppress the warnings from `date_default_timezone_set()` for now. In the future timezone management should maybe be mildly refactored to be injectable and default to UTC, but this will eliminate --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-04 03:03:06 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/monolog#944
No description provided.