Bug #70563 [NEW]: strtotime accepts spaces, dots and comma's as valid

From: Date: Wed, 23 Sep 2015 14:03:11 +0000
Subject: Bug #70563 [NEW]: strtotime accepts spaces, dots and comma's as valid
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-196187@lists.php.net to get a copy of this message
From: daftwally at gmail dot com Operating system: PHP version: Irrelevant Package: Date/time related Bug Type: Bug Bug description:strtotime accepts spaces, dots and comma's as valid 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 bug report at https://bugs.php.net/bug.php?id=70563&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=70563&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=70563&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=70563&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=70563&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=70563&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=70563&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=70563&r=needscript Try newer version: https://bugs.php.net/fix.php?id=70563&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=70563&r=support Expected behavior: https://bugs.php.net/fix.php?id=70563&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=70563&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=70563&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=70563&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=70563&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=70563&r=dst IIS Stability: https://bugs.php.net/fix.php?id=70563&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=70563&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=70563&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=70563&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=70563&r=mysqlcfg

« previous php.bugs (#196187) next »