#36266 [WFx]: strtotime behavior change

From: Date: Mon, 13 Feb 2006 14:38:50 +0000
Subject: #36266 [WFx]: strtotime behavior change
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-93214@lists.php.net to get a copy of this message
ID: 36266 User updated by: tim at komta dot com Reported By: tim at komta dot com Status: Wont fix Bug Type: Date/time related Operating System: Windows XP Pro SP2 PHP Version: 5CVS-2006-02-02 (snap) Assigned To: derick New Comment: By that logic, "1100" shouldn't work either, and yet, it does. Intriguingly, it works, not to the YEAR 1100, but to a time, 11:00:00 AM. Previous Comments: ------------------------------------------------------------------------ [2006-02-13 15:33:32] derick@php.net The documentation says "strtotime -- Parse about any English textual datetime description into a Unix timestamp". "11" is clearly not a textual datetime description. ------------------------------------------------------------------------ [2006-02-13 15:25:59] tim at komta dot com Unintentional changes in function behavior = bug. This whole strtotime "update" has caused nothing but trouble for me. I disagree that it's "very strange". Ask the next 10 people you see what today's date is. If ANY of them just say "13", I'll be extremely surprised. Ask them what year it is. I guarantee no one will say "6". Conversely, in basic conversation, asking what time it is will often get you an integer in response. The purpose of this function is to take strings and convert them to times. Except now, it only converts SOME strings, breaking functionality with previous versions. ------------------------------------------------------------------------ [2006-02-13 09:36:48] derick@php.net Guessing that two consequetive numbers mean an hour is very strange. It could just as well have been the day of the month, the month or even the year. That this worked in older versions is most likely a sideeffect of something and I do not plan to made a hack for this in the new parser. ------------------------------------------------------------------------ [2006-02-02 22:29:13] judas dot iscariote at gmail dot com $php5-debug strtotime.php bool(false) PHP 5.1.3-dev (cli) (built: Feb 2 2006 18:19:34) (DEBUG) $php4-debug strtotime.php int(1138888800) PHP 4.4.3-dev (cli) (built: Feb 1 2006 13:49:49) (DEBUG) ------------------------------------------------------------------------ [2006-02-02 21:25:03] tim at komta dot com strtotime('11') exhibits the same behavior change - seems that strtotime can no longer handle only 2 digits for a time. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/36266 -- Edit this bug report at http://bugs.php.net/?id=36266&edit=1

« previous php.bugs (#93214) next »