Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:67459 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 98346 invoked from network); 23 May 2013 18:48:57 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 May 2013 18:48:57 -0000 Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.219.50 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.219.50 mail-oa0-f50.google.com Received: from [209.85.219.50] ([209.85.219.50:33179] helo=mail-oa0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 68/AA-26812-8946E915 for ; Thu, 23 May 2013 14:48:57 -0400 Received: by mail-oa0-f50.google.com with SMTP id l20so4954224oag.37 for ; Thu, 23 May 2013 11:48:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=+r06JMx5a6Hsmw4dsn7gXQs2V2jNGcMwsjUxvSAPFx0=; b=iJqG4moLqMmMCfwBj2dM91ZPY8z0dCo4aIFgzmPN9LcuPu78nHT6vyAGwUw5N3HyWg pp2sX3HFNMWb0qkC7iZR0U7mYRPalEohaYz3sUY+dw8CVgFTen/U+QDuA1jeRCdB0fb2 7xfPY+xjIODnWrGcqkMhMBk9pWkSspXgWInmxqMx3Uml5mPWDF5m6DP1nv1GjHL7YoUQ C3cOkwsOgCTx3QgL/rANdlnl1+o0O8rO8mYoqO7pYPPlJ1kfGYpKFSkjKVsuPSuWBace IBWMaMAzx5mHHcAvxHRg2hqbd3pVRkcoUO32MLg+0LsROgZ39cdro1yuZwNdOxKtwVlZ tZMg== MIME-Version: 1.0 X-Received: by 10.60.84.67 with SMTP id w3mr967940oey.59.1369334933605; Thu, 23 May 2013 11:48:53 -0700 (PDT) Received: by 10.182.59.108 with HTTP; Thu, 23 May 2013 11:48:53 -0700 (PDT) In-Reply-To: References: Date: Thu, 23 May 2013 20:48:53 +0200 Message-ID: To: Daniel Lowrey Cc: PHP internals Content-Type: multipart/alternative; boundary=089e0111b8864cf11304dd6722db Subject: Re: [PHP-DEV] date.timezone E_WARNING -- Really necessary? What's the rationale? From: nikita.ppv@gmail.com (Nikita Popov) --089e0111b8864cf11304dd6722db Content-Type: text/plain; charset=ISO-8859-1 On Thu, May 23, 2013 at 8:40 PM, Daniel Lowrey wrote: > I'm probably not the typical PHP user; I spend 99% of my PHP time > using the CLI (and not web SAPIs). > This means that I frequently run PHP without an .ini file. As a > result, when I use any of the date/time > functionality I invariably end up with this awesomeness: > > > Warning: date(): It is not safe to rely on the system's timezone > settings blah blah blah. > > Could I run `$ php -d date.timezone=UTC myfile.php`? Of course, but > should that really be necessary? > It seems to me this warning caters to the very lowest common > denominator among PHP devs who can't > be bothered to understand how PHP handles timezones. The warning also > seems to assume that people only > use PHP as a web framework and not as an actual programming language > (otherwise I wouldn't have to > explain to the CLI which timezone I want to use). I don't need php.ini > ... I want to use PHP to *program*. > > If it's going to default to UTC anyway should there really be an > E_WARNING? Can't PHP just quietly use UTC? > The "U" in UTC *does* stand for "Universal," after all. It's a > sensible default and as such shouldn't > merit a warning. Besides, if someone doesn't understand what's > happening and gets unexpected date/time > results the first thing they're going to do (I hope) is hit their > favorite search engine for "set PHP timezone." > > Perhaps I'm the only person to experience ongoing annoyance at the > hands of this protective > "feature?" Is there a substantive reason why this warning exists other > than the error message's > suggestion that "you most likely misspelled the timezone identifier?" > I understand that one of PHP's > most attractive features is ease-of-use for programming novices but > you can only go so far in > preventing people who don't know what they're doing from shooting > themselves in the foot. > > I'm not sure if it's possible but perhaps a compromise might be to > disable this warning in the CLI, at least? Fully agreed. The warning is very annoying when using CLI. And even when not using CLI: The timezone is usually only relevant in production. I don't care if times are off a few hours when developing stuff. Nikita --089e0111b8864cf11304dd6722db--