com php-src: Fix #66486: strtotime only with whitespaces should return false: ext/date/php_date.c ext/date/tests/bug6648 6.phpt

From: Date: Sun, 12 Aug 2018 18:53:42 +0000
Subject: com php-src: Fix #66486: strtotime only with whitespaces should return false: ext/date/php_date.c ext/date/tests/bug6648 6.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-102862@lists.php.net to get a copy of this message
Commit: c0a44c668ed0692c97e0b60d56b0a5e42cd67a3c Author: Gabriel Caruso <carusogabriel34@gmail.com> Sun, 12 Aug 2018 15:53:42 -0300 Parents: 45a05f38410d4a67c8c83c09906e2cfb42fc6e4c Branches: bug/66486 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c0a44c668ed0692c97e0b60d56b0a5e42cd67a3c Log: Fix #66486: strtotime only with whitespaces should return false Bugs: https://bugs.php.net/66486 Changed paths: M ext/date/php_date.c A ext/date/tests/bug66486.phpt Diff: diff --git a/ext/date/php_date.c b/ext/date/php_date.c index 955b7e9..4872f45 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -1488,6 +1488,11 @@ PHP_FUNCTION(strtotime) RETURN_FALSE; } + while (isspace(*times)) { + times++; + time_len--; + } + tzi = get_timezone_info(); now = timelib_time_ctor(); diff --git a/ext/date/tests/bug66486.phpt b/ext/date/tests/bug66486.phpt new file mode 100644 index 0000000..0c742c6 --- /dev/null +++ b/ext/date/tests/bug66486.phpt @@ -0,0 +1,14 @@ +--TEST-- +Bug #66486 strtotime only with whitespaces should return false +--FILE-- +<?php +var_dump( + strtotime(''), + strtotime(' '), + strtotime(' ') +); +?> +--EXPECTF-- +bool(false) +bool(false) +bool(false)

« previous php.cvs (#102862) next »