Req #76785 [Asn->Wfx]: DateTime construction with a negative year argument shows different behaviours

From: Date: Sun, 05 Jun 2022 14:25:14 +0000
Subject: Req #76785 [Asn->Wfx]: DateTime construction with a negative year argument shows different behaviours
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-241672@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76785&edit=1 ID: 76785 Updated by: derick@php.net Reported by: thijs at tsjeng dot nl Summary: DateTime construction with a negative year argument shows different behaviours -Status: Assigned +Status: Wont fix Type: Feature/Change Request Package: Date/time related PHP Version: Irrelevant Assigned To: derick Block user comment: N Private report: N New Comment: I am marking this as "won't fix". If you are still interested in having this feature, please file a new issue at https://github.com/php/php-src/issues/ with a well defined and explained use case. Previous Comments: ------------------------------------------------------------------------ [2020-01-20 17:35:46] girgias@php.net This maybe should be reclassified as a Feature request, leaving Derick to decide about it. ------------------------------------------------------------------------ [2018-11-28 14:19:15] bjoern dot fischer at dezem dot de We are affected by this issue too. It can be easily reproduced here: https://3v4l.org/LY6FJ ------------------------------------------------------------------------ [2018-08-23 17:10:15] requinix@php.net Fortunately 'U' already supports signed numbers so extending that to 'Y' shouldn't be difficult. ------------------------------------------------------------------------ [2018-08-23 15:29:40] thijs at tsjeng dot nl Description: ------------ DateTime object instantiation with negative input string via 'createFromFormat' and same argument just as construction argument display weird behaviour. Test script: --------------- var_dump(DateTime::createFromFormat('Y-m-d', '0045-01-01')); // works var_dump(DateTime::createFromFormat('Y-m-d', '-0045-01-01')); // false var_dump(DateTime::createFromFormat('-Y-m-d', '-0045-01-01')); // works, but year is positive instead of negative var_dump(new DateTime('0045-01-01')); // works var_dump(new DateTime('-0045-01-01')); // works var_dump(new DateTime('0045/01/01')); // works var_dump(new DateTime('-0045/01/01')); // exception ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=76785&edit=1

« previous php.bugs (#241672) next »