Re: date.timezone E_WARNING -- Really necessary? What's the rationale?

From: Date: Sat, 25 May 2013 15:25:35 +0000
Subject: Re: date.timezone E_WARNING -- Really necessary? What's the rationale?
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to [email protected] to get a copy of this message
On Sat, May 25, 2013 at 5:09 PM, Levi Morrison <[email protected]>wrote:

> >> It is actually only about getting safe, cross platform/OS (even
> >> between Linux versions) for the TZ database. It has nothing to do
> >> with taste or similar subjective opinion.
> >>
> >> For the record, the behavior requested in this thread is what we had
> >> in earlier versions, all we got was plenty of bugs reports about
> >> wrong TZ detections.
> >>
> >
> > I had missed the removal of the TZ detection code from
> > guess_timezone() in 5.4. So @date_default_timezone_get() is somewhat
> > less useful than it used to be, as a function for detecting system
> > settings.
> >
> >> I think it is not too much asking to set it in php.ini or in your
> >> application.
> >>
> >
> > At least for MediaWiki, it's certainly more important to avoid
> > warnings than it is to have the right local timezone. UTC is used in
> > any case where consistency is important. Based on other posts to this
> > list, I don't think we're alone in this.
>
> For the record, the PHP 5.4+ date_default_timezone_get is equivalent to
>
>     ini_get('date.timezone') ?: 'UTC'
>
> except that date_default_timezone_get will raise a warning and the
> above will not.
>
>
and the fact that date_default_timezone_get wouldn't return invalid
timezone, while ini_get would:
./sapi/cli/php -n -d date.timezone="Foo/Bar"  -r
'var_dump(@date_default_timezone_get());var_dump(ini_get("date.timezone")?:"UTC");'
string(3) "UTC"
string(7) "Foo/Bar"



-- 
Ferenc Kovács
@Tyr43l - http://tyrael.hu


Thread (70 messages)

« previous php.internals (#67519) next »