From:             four dot zero dot one dot unauthorized at gmail dot com
Operating system: any
PHP version:      5.4.17
Package:          Date/time related
Bug Type:         Bug
Bug description:DateTime::getLastErrors() does not include default timezone 
problems

Description:
------------
When ever date.timezone INI setting or date_default_timezone_set() is used
and a clearly invalid timezone ID is set, DateTime::getLastErrors() has no
indication of this.  Same if no timezone is set.

Test script:
---------------
// assume date.timezone currently set to "America/Los_Angeles" for this
test
date_default_timezone_set( "asdf" );
try {
        $d = new DateTime();
}
catch ( Exception $ex ) {
        var_dump( DateTime::getLastErrors() ); // never even reached - $d is
actually valid and set to "America/Los_Angeles" timezone, and
DateTime::getLastErrors() has no errors listed
}

ini_set( "date.timezone",  "asdf" );
try {
        $d = new DateTime();
}
catch ( Exception $ex ) {
        var_dump( DateTime::getLastErrors() ); // reached, but no errors listed
here
}

Expected result:
----------------
DateTime::getLastErrors() always contains the "The timezone could not be
found in the database" error if a bad timezone name is preset, or "You are
*required* to use the date.timezone setting or the
date_default_timezone_set() function" error if no timezone name is preset.

Actual result:
--------------
DateTime::getLastErrors() contains no such errors or warnings.

-- 
Edit bug report at https://bugs.php.net/bug.php?id=65313&edit=1
-- 
Try a snapshot (PHP 5.4):   
https://bugs.php.net/fix.php?id=65313&r=trysnapshot54
Try a snapshot (PHP 5.3):   
https://bugs.php.net/fix.php?id=65313&r=trysnapshot53
Try a snapshot (trunk):     
https://bugs.php.net/fix.php?id=65313&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=65313&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=65313&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=65313&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=65313&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=65313&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=65313&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=65313&r=notwrong
Not enough info:            
https://bugs.php.net/fix.php?id=65313&r=notenoughinfo
Submitted twice:            
https://bugs.php.net/fix.php?id=65313&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=65313&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=65313&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=65313&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=65313&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=65313&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=65313&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=65313&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=65313&r=mysqlcfg

Reply via email to