Bug #62130 [NEW]: DateTime constructor accepts invalid TZ abbreviations

From: Date: Wed, 23 May 2012 19:52:49 +0000
Subject: Bug #62130 [NEW]: DateTime constructor accepts invalid TZ abbreviations
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-170731@lists.php.net to get a copy of this message
From: kavi at postpro dot net Operating system: Linux PHP version: Irrelevant Package: Date/time related Bug Type: Bug Bug description:DateTime constructor accepts invalid TZ abbreviations Description: ------------ PHP will accept invalid DST-related time zone abbreviations, e.g. daylight savings time when daylight savings time cannot be in effect on the given date; subsequent operations on the returned object may produce invalid results. This should produce an error. Test script: --------------- $dt = new DateTime('1980-01-01 15:00:00 PDT'); print_r($dt); $dt->modify('+1 hour'); print_r($dt); Expected result: ---------------- EXPECTED output should be an error. Actual result: -------------- DateTime Object ( [date] => 1980-01-01 15:00:00 [timezone_type] => 2 [timezone] => PDT ) DateTime Object ( [date] => 1980-01-01 15:00:00 [timezone_type] => 2 [timezone] => PDT ) Note that PDT is invalid for the given date, and the modify() call didn't work and also didn't throw an error. -- Edit bug report at https://bugs.php.net/bug.php?id=62130&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=62130&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=62130&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=62130&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=62130&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=62130&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=62130&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=62130&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=62130&r=needscript Try newer version: https://bugs.php.net/fix.php?id=62130&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=62130&r=support Expected behavior: https://bugs.php.net/fix.php?id=62130&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=62130&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=62130&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=62130&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=62130&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=62130&r=dst IIS Stability: https://bugs.php.net/fix.php?id=62130&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=62130&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=62130&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=62130&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=62130&r=mysqlcfg

« previous php.bugs (#170731) next »