#50534 [Opn->Csd]: strtotime does not return false with wrong input

From: Date: Sun, 20 Dec 2009 00:00:52 +0000
Subject: #50534 [Opn->Csd]: strtotime does not return false with wrong input
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-145934@lists.php.net to get a copy of this message
ID: 50534 Updated by: derick@php.net Reported By: scripting at frag-em dot com -Status: Open +Status: Closed Bug Type: Date/time related Operating System: CentOS 4.3 PHP Version: 5.2.12 New Comment: This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. This is already fixed for PHP 5.3. Previous Comments: ------------------------------------------------------------------------ [2009-12-19 23:51:34] scripting at frag-em dot com Description: ------------ strtotime parses some forms of characters (probably as long as there is a separation with dots) to timestamps. If there's no real date, it fails to return false. date_default_timezone_set has been properly set Reproduce code: --------------- date_default_timezone_set('Europe/Amsterdam'); $time = strtotime("T.B.A."); var_dump($time); $time = strtotime("T.BA."); var_dump($time); $time = strtotime("TB.A."); var_dump($time); $time = strtotime("TBA"); var_dump($time); Expected result: ---------------- bool(false) bool(false) bool(false) bool(false) Actual result: -------------- int(somenumberthatchanges) int(somenumberthatchanges) bool(false) bool(false) ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50534&edit=1

« previous php.bugs (#145934) next »