php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39142 Remove the obnoxious date() warning
Submitted: 2006-10-13 00:53 UTC Modified: 2010-12-06 14:56 UTC
From: danc at merrillpress dot com Assigned:
Status: Not a bug Package: Date/time related
PHP Version: 5.1.6 OS: RHEL4
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: danc at merrillpress dot com
New email:
PHP Version: OS:

Further comment on this bug is unnecessary.

 

 [2006-10-13 00:53 UTC] danc at merrillpress dot com
Description:
------------
In the rewritten date functions, the system emits an E_STRICT warning when date() is called without the timezone having been set via date_default_timezone_set() or date.timezone in an INI file.

This is bad behavior. While being able to override the time zone is a nice feature, the system time zone is usually set correctly, and forcing users to specify it twice (once in the overall system configuration and once specifically for PHP) serves no purpose.

Reproduce code:
---------------
date()

Expected result:
----------------
E_STRICT

Actual result:
--------------
No warning of any kind

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-10-13 11:02 UTC] tony2001@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

>forcing users to specify it twice (once in the overall
>system configuration and once specifically for PHP) serves no purpose.
The point is that without date.timezone PHP *guesses* timezone. 
Even if the system timezone is set correctly, it doesn't mean PHP is able to guess it, since timezone names are different across different OSes.
 [2010-12-06 12:05 UTC] giecrilj at stegny dot 2a dot pl
If the system timezone is set correctly, PHP can use the numeric offset of the time zone to match its internal records.
 [2010-12-06 12:34 UTC] johannes@php.net
No it can't. different regions with the same offset use different times to switch to/from daylight saving times (if they do at all) Which makes date/time calculations incorrect. The current way of doing this is the only way we can guarantee compatible behaviour on all supported platforms.
 [2010-12-06 12:54 UTC] giecrilj at stegny dot 2a dot pl
But when system switches to DST, date +%z changes too.
Besides, this is a problem only for GNU libc-based systems, 
other systems can use env TZ.
 [2010-12-06 14:56 UTC] derick@php.net
TZ env vars values are not shared between operating systems either; so that's not a good source.
 [2010-12-06 14:56 UTC] derick@php.net
-Block user comment: N +Block user comment: Y
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 17:01:29 2024 UTC