Bug #70563 [Opn->Ver]: strtotime accepts spaces, dots and comma's as valid

From: Date: Thu, 29 Mar 2018 18:13:53 +0000
Subject: Bug #70563 [Opn->Ver]: strtotime accepts spaces, dots and comma's as valid
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-214532@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70563&edit=1 ID: 70563 Updated by: cmb@php.net Reported by: daftwally at gmail dot com Summary: strtotime accepts spaces, dots and comma's as valid -Status: Open +Status: Verified Type: Bug Package: Date/time related PHP Version: Irrelevant Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2015-09-23 14:03:10] daftwally at gmail dot com Description: ------------ the strtotime() function accepts a string with one or more spaces (' '), one or more dots ('.') or one or more comma's (',') or a combination of these with no other valid date/time information as acceptable and returns a timestamp (now) instead of the expected FALSE. Here is the output on a bunch of different PHP versions -> https://3v4l.org/kSH46 Test script: --------------- <?php var_dump(strtotime(" ")); var_dump(strtotime(",")); var_dump(strtotime(".")); var_dump(strtotime(". .. .. .. .... .. . .. .")); var_dump(strtotime(". .. .. .. ..,,,.. .. . .. .")); var_dump(strtotime("bogus")); Expected result: ---------------- boolean false boolean false boolean false boolean false boolean false boolean false Actual result: -------------- int 1443016200 int 1443016200 int 1443016200 int 1443016200 int 1443016200 boolean false ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=70563&edit=1

« previous php.bugs (#214532) next »