From:             omg00dness at yahoo dot com
Operating system: Ubuntu
PHP version:      5.3.13
Package:          Date/time related
Bug Type:         Bug
Bug description:strtotime() returns incorrect time around DST (America)

Description:
------------
For an American timezone (at least those that observe Daylight Savings
Time), strtotime() is outputting incorrectly when adding a negative time
string.

Example uses March 11, 2012 at 2:00am, where the local time jumps instead
to 3:00am.

Test script:
---------------
<?php
date_default_timezone_set('America/Los_Angeles'); 
echo date("M j Y H:i:s I", strtotime("2012-03-11 5:00:00 -1 hour")) .
"\n";
echo date("M j Y H:i:s I", strtotime("2012-03-11 4:00:00 -1 hour")) .
"\n";
echo date("M j Y H:i:s I", strtotime("2012-03-11 3:00:00 -1 hour")) .
"\n";
echo date("M j Y H:i:s I", strtotime("2012-03-11 3:01:00 -1 hour")) .
"\n";
echo date("M j Y H:i:s I", strtotime("2012-03-11 2:59:00 -1 hour")) .
"\n";
echo date("M j Y H:i:s I", strtotime("2012-03-11 1:00:00 +1 hour")) .
"\n";
echo date("M j Y H:i:s I", strtotime("2012-03-11 0:00:00 +1 hour")) .
"\n";
?>

Expected result:
----------------
Mar 11 2012 04:00:00 1
Mar 11 2012 03:00:00 1
Mar 11 2012 01:00:00 0
Mar 11 2012 01:01:00 0
Dec 31 1969 16:00:00 0 //Perhaps output false?
Mar 11 2012 03:00:00 1
Mar 11 2012 01:00:00 0

Actual result:
--------------
Mar 11 2012 04:00:00 1
Mar 11 2012 03:00:00 1
Mar 11 2012 03:00:00 1
Mar 11 2012 03:01:00 1
Mar 11 2012 01:59:00 0
Mar 11 2012 03:00:00 1
Mar 11 2012 01:00:00 0

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

Reply via email to