Bug #61022 [NEW]: DateTime constructor ignores DateTimeZone argument in favor of string TZ

From: Date: Thu, 09 Feb 2012 02:30:45 +0000
Subject: Bug #61022 [NEW]: DateTime constructor ignores DateTimeZone argument in favor of string TZ
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-167327@lists.php.net to get a copy of this message
From: Operating system: n/a PHP version: trunk-SVN-2012-02-09 (SVN) Package: Date/time related Bug Type: Bug Bug description:DateTime constructor ignores DateTimeZone argument in favor of string TZ Description: ------------ When creating a new DateTime object, if given a parseable string with a timezone descriptor such as "Monday, 15-Aug-05 15:52:01 PDT" AND a DateTimeZone argument, the DateTimeZone argument will be completely ignored. Please either reopen #40743 or fix this bug if it is a regression for a different reason. This is broken on 5.3.3 and trunk. Test script: --------------- $a = new DateTime('Monday, 15-Aug-05 15:52:01 PDT', new DateTimeZone('America/New_York')); print_r($a); Expected result: ---------------- An exception. If you absolutely must, which you shouldn't, a warning and an automatic conversion of the date string to the proper time in America/New_York. Actual result: -------------- DateTime Object ( [date] => 2005-08-15 15:52:01 [timezone_type] => 2 [timezone] => PDT ) -- Edit bug report at https://bugs.php.net/bug.php?id=61022&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=61022&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=61022&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=61022&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=61022&r=fixed Fixed in SVN and need be documented: https://bugs.php.net/fix.php?id=61022&r=needdocs Fixed in release: https://bugs.php.net/fix.php?id=61022&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=61022&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=61022&r=needscript Try newer version: https://bugs.php.net/fix.php?id=61022&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=61022&r=support Expected behavior: https://bugs.php.net/fix.php?id=61022&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=61022&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=61022&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=61022&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=61022&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=61022&r=dst IIS Stability: https://bugs.php.net/fix.php?id=61022&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=61022&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=61022&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=61022&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=61022&r=mysqlcfg

« previous php.bugs (#167327) next »