Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:67528 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 26019 invoked from network); 26 May 2013 11:42:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 May 2013 11:42:18 -0000 Authentication-Results: pb1.pair.com smtp.mail=rquadling@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rquadling@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.223.173 as permitted sender) X-PHP-List-Original-Sender: rquadling@gmail.com X-Host-Fingerprint: 209.85.223.173 mail-ie0-f173.google.com Received: from [209.85.223.173] ([209.85.223.173:53361] helo=mail-ie0-f173.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0D/22-32733-915F1A15 for ; Sun, 26 May 2013 07:42:17 -0400 Received: by mail-ie0-f173.google.com with SMTP id k5so16284633iea.32 for ; Sun, 26 May 2013 04:42:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=PQB26zVfOOa7IG/klv0xekFtI6g4KWRgwZ6+cFeUb68=; b=kn3xFLpKykYAuxEfV+5MD30RwerMqL8Ngxu581gLdhvCfdBzHAGi7Lbt3yVgpv4U7D 1i+reRggJ2r7eH3rIZnr2ZuUjrgu61tOSJ9sEbhm6+qZnqpYhrs+EpPrdxJl1IBjB7Wp f+9b0iMCwUsl10fh/blHW9FBSU94Y3qHIuPgtLhrM7eu4x9rvlq0q64Wm6sMWyM3bzbU Vpr81WT0mc8OeYePHY8mG8srAEnUmKZNXGjBG+UcHQyrvpFMITISA6poeBGi9ds5BTkL XH3Eq/tsF5SEUoxRuWwp5MelkwqTHoKsMxbfFysLjwbR3TD3U5xeFqAD27ngdlGtmeSL BmKg== X-Received: by 10.50.97.38 with SMTP id dx6mr2912262igb.45.1369568533912; Sun, 26 May 2013 04:42:13 -0700 (PDT) MIME-Version: 1.0 Received: by 10.64.96.74 with HTTP; Sun, 26 May 2013 04:41:53 -0700 (PDT) Reply-To: RQuadling@GMail.com In-Reply-To: <51A1AF3E.5000704@sugarcrm.com> References: <51A092FC.4010700@wikimedia.org> <51A1AF3E.5000704@sugarcrm.com> Date: Sun, 26 May 2013 12:41:53 +0100 Message-ID: To: Stas Malyshev Cc: Levi Morrison , PHP internals Content-Type: multipart/alternative; boundary=047d7b10d1dbf5a58b04dd9d854f Subject: Re: [PHP-DEV] date.timezone E_WARNING -- Really necessary? What's the rationale? From: rquadling@gmail.com (Richard Quadling) --047d7b10d1dbf5a58b04dd9d854f Content-Type: text/plain; charset=UTF-8 On 26 May 2013 07:44, Stas Malyshev wrote: > Hi! > > > I did not do a very good job explaining what I meant. I meant to say > > that requiring the timezone to be set prevents you from running > > without an ini file without any warnings. This is a big annoyance. > > If you insist on using the tool in a wrong way, you will be annoyed as > the tool would not work in a way you want it to work. The right way is > to set up the ini file. It takes about 2 seconds. Not in direct response to the above point, but more of a comment on this thread, and the various reappearances of this thread. As I understand things, some of the issues with asking the OS for the timezone are: 1 - The OS may not present a timezone in a way that PHP can easily access in a consistent way (i.e. too many flavours, mechanisms, etc.). 2 - The machine's local time and/or timezone may not be set correctly anyway. A point come to mind, in addition to all of this (and I'm not an expert, but this may be important) ... As more and more site/services are being hosted in the cloud, allowing requests to be handled locally geographically, in different timezones, does it make ANY sense in setting a timezone at all other than UTC? From what I can see, a server (which may not be under our control) COULD have pretty much any time and/or timezone on it. So even if we DO set a timezone in PHP, the time could still be out and that really isn't a good thing. If setting the timezone is so critical that a warning MUST be given when it is not set and that by ignoring the warning (either because of a lazy dev or a dev who cannot see the warning due to shared setup or something else) the scripts running that rely on accurate datetimezone, why not make this a fatal error. Yes. I know you've all jumped off your chairs to complain, but either PHP MUST have this setting appropriately, or it can live without it. The grey area of "PHP can run, but your results, well, meh!" does not fit well. If all it takes is 2s to set the INI file, why bother running without the setting. Is there any process that could be run that would do the following ... 1 - Determine the machines current date/time. 2 - Determine the machines current timezone (or lack of ability to return that information). 3 - Verify the local time with a known/accurate/maintained time server. 4 - From all of this, make an accurate decision or best guess as to what the timezone should be. 5 - Set an entry in the php.ini file appropriate for the guessed_timezone. So, the warning COULD be given, but allow a dev to run a PHP Team sourced process to determine where in the world the server is (I have access to servers all over Europe. I don't know the timezones that they are all in initially and had to work to confirm that the machine date/time/timezone was accurate. It would seem that a script could do this better, consistently, etc.). Just an idea on trying to solve this. If it could be automated, essentially whatever manual steps a dev would take to accurately set the timezone on an unknown server, then this process would certainly seem to be useful. But only because PHP gives a warning that the lack of the timezone is an issue. Regards, Richard. -- Richard Quadling Twitter : @RQuadling EE : http://e-e.com/M_248814.html Zend : http://bit.ly/9O8vFY --047d7b10d1dbf5a58b04dd9d854f--