From:             herrnoel at gmail dot com
Operating system: Linux/Debian 5.0.3
PHP version:      5.2.11
PHP Bug Type:     Date/time related
Bug description:  strototime() incorrectly parses first sunday of Nov 2009

Description:
------------
Actual php version is latest from debian stable: PHP 5.2.6-1+lenny3

When using strtotime() for some really handy english parsing, it works
great EXCEPT for the first day of the month.

The format is as follows:

[1-4] [day of week] [month] [year]

If the day of the week is the first day of the month, this will return the
date starting one week ahead of the first day of the month. Otherwise, the
behavior is as expected.

This is repeatable for all months.  If you leave out the initial digit,
the broken first day of the month works, but then you must use 1 to
indicate the 2nd instance of that day and so on.

Reproduce code:
---------------
echo date('Y-m-d', strtotime('1 thu oct 2009')); # first day of month
echo date('Y-m-d', strtotime('1 fri oct 2009')); # second day of month
echo date('Y-m-d', strtotime('1 sun nov 2009')); # first day of month
echo date('Y-m-d', strtotime('2 sun nov 2009')); # second sunday of month
(sunday is the first day of month)


Expected result:
----------------
2009-10-01
2009-10-02
2009-11-01
2009-11-08


Actual result:
--------------
2009-10-08
2009-10-02
2009-11-08
2009-11-15

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

Reply via email to