Bug #67324 [Opn->Wfx]: DateTime::createFromFormat wrong result

From: Date: Thu, 22 May 2014 21:48:05 +0000
Subject: Bug #67324 [Opn->Wfx]: DateTime::createFromFormat wrong result
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-185898@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=67324&edit=1 ID: 67324 Updated by: aharvey@php.net Reported by: volny dot licvin at gmail dot com Summary: DateTime::createFromFormat wrong result -Status: Open +Status: Wont fix Type: Bug -Package: *General Issues +Package: Date/time related Operating System: Linux PHP Version: Irrelevant Block user comment: N Private report: N New Comment: createFromFormat(), like other functions that parse free text date strings, will wrap out of range values rather than generating errors, so long as they match the expected format (in terms of number of digits). Previous Comments: ------------------------------------------------------------------------ [2014-05-22 11:42:21] volny dot licvin at gmail dot com Description: ------------ DateTime::createFromFormat not checking properly provided format (day [01-31] and month [01-12] limitations) and only checking number of digits. Test script: --------------- <?php var_dump(DateTime::createFromFormat('Y-m-d', '9999-99-99')); Expected result: ---------------- bool(false) Actual result: -------------- object(DateTime)#9 (3) { ["date"]=> string(20) "10007-06-07 13:28:21" ["timezone_type"]=> int(3) ["timezone"]=> string(13) "Europe/Berlin" } ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=67324&edit=1

« previous php.bugs (#185898) next »