From: flavius dot as at gmail dot com Operating system: Linux x64 PHP version: 5.4.9 Package: Date/time related Bug Type: Bug Bug description:DateTime::modify() ignores timezone
Description: ------------ DateTime::modify() ignores the timezone (when using the RFC 2822 format for instance). The right timestamp should be $t1 (from the example below). Test script: --------------- <?php $str = "Tue, 10 Apr 2012 11:27:56 +0300"; $d1 = new DateTime($str); $d2 = new DateTime; $d2->modify($str); $t1 = $d1->getTimestamp(); $t2 = $d2->getTimestamp(); $tz1 = $d1->getTimezone()->getName(); $tz2 = $d2->getTimezone()->getName(); $f1 = $d1->format(DateTime::RFC2822); $f2 = $d2->format(DateTime::RFC2822); var_dump(compact('t1', 't2', 'tz1', 'tz2', 'f1', 'f2')); /* array(6) { 't1' => int(1334046476) 't2' => int(1334050076) 'tz1' => string(6) "+03:00" 'tz2' => string(13) "Europe/Vienna" 'f1' => string(31) "Tue, 10 Apr 2012 11:27:56 +0300" 'f2' => string(31) "Tue, 10 Apr 2012 11:27:56 +0200" } */ Expected result: ---------------- $t1 == $t2 Actual result: -------------- $t1 != $t2 -- Edit bug report at https://bugs.php.net/bug.php?id=63615&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=63615&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=63615&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=63615&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=63615&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=63615&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=63615&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=63615&r=needscript Try newer version: https://bugs.php.net/fix.php?id=63615&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=63615&r=support Expected behavior: https://bugs.php.net/fix.php?id=63615&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=63615&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=63615&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=63615&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=63615&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=63615&r=dst IIS Stability: https://bugs.php.net/fix.php?id=63615&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=63615&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=63615&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=63615&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=63615&r=mysqlcfg