From: istvan dot dani at gmail dot com
Operating system: OS X 10.8
PHP version: Irrelevant
Package: Date/time related
Bug Type: Bug
Bug description:DateTime's constructor accepts time that not exists because of
DST
Description:
------------
Europe/Budapest timezone offset is +1, and +2 in DST.
Transition to DST is at 2013-03-31 01:00:00 UTC/GMT.
According to this, locale time should not exists between 02:00:00 and
03:00:00,
and must not be accepted as valid time.
Test script:
---------------
try {
$wrong_date = new DateTime("2013-03-31 02:30:00", new
DateTimeZone("Europe/Budapest"));
} catch (Exception $e) {
echo $e->getMessage();
}
print "Wrong date in local timezone: " . $wrong_date->format("Y-m-d
H:i:s");
$wrong_date->setTimezone(new DateTimeZone("UTC"));
print "<br />Converting to UTC: " . $wrong_date->format("Y-m-d H:i:s");
$wrong_date->setTimezone(new DateTimeZone("Europe/Budapest"));
print "<br />Converting back to locale timezone: " .
$wrong_date->format("Y-m-d H:i:s");
Expected result:
----------------
Get an exception.
Actual result:
--------------
Wrong date in local timezone: 2013-03-31 02:30:00
Converting to UTC: 2013-03-31 01:30:00
Converting back to locale timezone: 2013-03-31 03:30:00
--
Edit bug report at https://bugs.php.net/bug.php?id=64908&edit=1
--
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=64908&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=64908&r=trysnapshot53
Try a snapshot (trunk):
https://bugs.php.net/fix.php?id=64908&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=64908&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=64908&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=64908&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=64908&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=64908&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=64908&r=support
Expected behavior: https://bugs.php.net/fix.php?id=64908&r=notwrong
Not enough info:
https://bugs.php.net/fix.php?id=64908&r=notenoughinfo
Submitted twice:
https://bugs.php.net/fix.php?id=64908&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=64908&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64908&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=64908&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=64908&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=64908&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=64908&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=64908&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=64908&r=mysqlcfg