Req #71649 [Com]: DateTime createFromFormat ATOM_DATE accepting short year value

From: Date: Fri, 05 May 2023 06:08:46 +0000
Subject: Req #71649 [Com]: DateTime createFromFormat ATOM_DATE accepting short year value
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-244372@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71649&edit=1 ID: 71649 Comment by: vishalbhawan65 at gmail dot com Reported by: chehax at gmail dot com Summary: DateTime createFromFormat ATOM_DATE accepting short year value Status: Open Type: Feature/Change Request Package: *Programming Data Structures Operating System: OSX 10.11.3 PHP Version: 5.6.18 Block user comment: N Private report: N New Comment: Technology web inc are sharing latest news about tech, web development, seo, smo, mobile apps, digital marketing etc. More info to visit: (https://technologywebinc.com)github.com Previous Comments: ------------------------------------------------------------------------ [2016-02-23 11:34:43] chehax at gmail dot com Description: ------------ --- From manual page: http://www.php.net/class.datetime --- It appears that creating a datetime object via createFromFormat and using DATEATOM support short year format, like 20-01-01T15:15:15Z. This isn't matching format which is Y-m-d\TH:i:sO and should return false. Doc for Y string format : + A full numeric representation of a year, 4 digits Test script: --------------- <?php $d = DateTime::createFromFormat(DATE_ATOM, "20-01-01T01:01:01Z"); var_dump($d); // should return false ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=71649&edit=1

« previous php.bugs (#244372) next »