#42675 [Opn->Asn]: strtotime returns valid dates for invalid entries

From: Date: Sun, 16 Sep 2007 15:37:42 +0000
Subject: #42675 [Opn->Asn]: strtotime returns valid dates for invalid entries
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-117586@lists.php.net to get a copy of this message
 ID:               42675
 Updated by:       iliaa@php.net
 Reported By:      amykhar at gmail dot com
-Status:           Open
+Status:           Assigned
 Bug Type:         Date/time related
 Operating System: Mac OS X
 PHP Version:      5.2.4
-Assigned To:      
+Assigned To:      derick
 New Comment:

That is expected behavior. Although I would assume rather just adding 1

month to the date it would add 1 month + remaining # of days.

My expected return value would be: October 15, 1992


Previous Comments:
------------------------------------------------------------------------

[2007-09-14 21:51:04] amykhar at gmail dot com

Description:
------------
If I enter a date with a text month and an invalid day, it returns as
valid.

Example, September 45, 1992 returns as valid.  It THINKS the date is
October 5, 1992.

(The same is true for Sep 45, 1992).

What it seems to do is to get the year correctly, then take the last
digit of the day and then add 1 to the month.



Reproduce code:
---------------
    	$cdate = strtotime("September 45, 1992");
    	if(!$cdate){
    		echo(-1);
    		exit;
    	}
        else{
             echo (date("M d Y",$cdate);
        }

Expected result:
----------------
It echo -1.

Actual result:
--------------
It prints out October 5, 1992


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=42675&edit=1


Thread (5 messages)

« previous php.bugs (#117586) next »