|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2008-09-02 22:57 UTC] phocis at gmail dot com
Description: ------------ Strtotime returns time() with any string that begins with 'eat' While this is related to: http://bugs.php.net/bug.php?id=43960 It is not exactly the same. Reproduce code: --------------- var_dump(strtotime('10 September 2000')); var_dump(strtotime('10 September 2000 asdfasdfasdf')); var_dump(strtotime('asdfasdfasdf 10 September 2000')); var_dump(strtotime('eat')); var_dump(strtotime('eat asdfasdfasdf')); var_dump(strtotime('asdfasdfasdf eat')); var_dump(strtotime('EAT')); Expected result: ---------------- int(968569200) # 10 sept 200 bool(false) bool(false) bool(false) bool(false) bool(false) bool(false) Actual result: -------------- int(968569200) # 10 sept 200 bool(false) bool(false) int(1220360063) # time() int(1220360063) # time() bool(false) int(1220360063) # time() PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Nov 03 01:00:01 2025 UTC |
So, I read the other bug report's comments a little more thoroughly and found out about "Double timezone specification"s. What I really wanted was a is_perfect_time: function is_perfect_time($time){ $parsed = date_parse($time); return ( $parsed['error_count'] === 0 && $parsed['warning_count'] === 0 ); } Sorry for the premature bug report. -Carl