|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-07-11 15:35 UTC] al dot vazquez at gmail dot com
Description:
------------
strtotime return the current timestamp for the values 'A Revolution in Development' and 'a nothing'. Expected return value is false. This seems to be tripped by the first character being the letter 'a' or 'A' followed by a space followed by more text.
Reproduce code:
---------------
echo strtotime('Ask the Experts');
echo strtotime('A ');
echo strtotime('A');
echo strtotime('a ');
echo strtotime('a');
echo strtotime('A Revolution in Development');
echo strtotime('a nothing');
Expected result:
----------------
false
false
false
false
false
false
false
Actual result:
--------------
false
false
false
false
false
current timestamp
current timestamp
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 09:00:02 2025 UTC |
There is indeed a bug: derick@kossu:~$ php -r 'var_dump(date_parse("A"));' array(12) { ["year"]=> bool(false) ["month"]=> bool(false) ["day"]=> bool(false) ["hour"]=> bool(false) ["minute"]=> bool(false) ["second"]=> bool(false) ["fraction"]=> bool(false) ["warning_count"]=> int(0) ["warnings"]=> array(0) { } ["error_count"]=> int(1) ["errors"]=> array(1) { [0]=> string(12) "Empty string" } ["is_localtime"]=> bool(false) } It is not an empty string... Derick