|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2018-08-27 09:44 UTC] cmb@php.net
-Package: *General Issues
+Package: Date/time related
[2020-01-20 17:37 UTC] girgias@php.net
-Assigned To:
+Assigned To: derick
[2020-01-20 17:37 UTC] girgias@php.net
[2020-04-11 13:04 UTC] cmb@php.net
-Status: Assigned
+Status: Not a bug
[2020-04-11 13:04 UTC] cmb@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 13:00:01 2025 UTC |
Description: ------------ The following code will return `DateTimeImmutable` when using the `createFromFormat` method. However, the following code will return `ChildDateTimeImmutable` when `setDate` is executed. Test script: --------------- <?php class ChildDateTimeImmutable extends DateTimeImmutable { } $child = new ChildDateTimeImmutable('2018-08-01'); assert($child->createFromFormat('Y-m-d', '2018-01-01') instanceof ChildDateTimeImmutable); assert($child->setDate(2018, 1, 1) instanceof ChildDateTimeImmutable); Expected result: ---------------- I expectation is to return `ChildDateTimeImmutable` when using` createFromFormat`. Actual result: -------------- Warning: assert(): assert($child->createFromFormat('Y-m-d', '2018-01-01') instanceof ChildDateTimeImmutable) failed in /private/tmp/20180824140235.php on line 7 Call Stack: 0.0009 361408 1. {main}() /private/tmp/20180824140235.php:0 0.0049 362504 2. assert() /private/tmp/20180824140235.php:7