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

From: Date: Mon, 05 Apr 2021 16:21:41 +0000
Subject: Bug #70563 [Ver->Nab]: strtotime accepts spaces, dots and comma's as valid
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-233181@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:         derick@php.net
 Reported by:        daftwally at gmail dot com
 Summary:            strtotime accepts spaces, dots and comma's as valid
-Status:             Verified
+Status:             Not a bug
 Type:               Bug
 Package:            Date/time related
 PHP Version:        Irrelevant
 Block user comment: N
 Private report:     N

 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php




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


Thread (3 messages)

« previous php.bugs (#233181) next »