Skip to content

keep DateTimeImmutable inner and outer dates in sync, fixes #759 - #760

Merged
shish merged 1 commit into
thecodingmachine:masterfrom
JoniJnm:fix/759-datetimeimmutable-constructor
Oct 24, 2026
Merged

shish merged 1 commit into
thecodingmachine:masterfrom
JoniJnm:fix/759-datetimeimmutable-constructor

Conversation

@JoniJnm

@JoniJnm JoniJnm commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

The constructor created the parent and the inner \DateTimeImmutable separately, so relative times like 'now' could differ by microseconds between the two, breaking diff() and comparisons. Build the inner date first and initialise the parent from its exact value and timezone.

fixes #759

@JoniJnm
JoniJnm force-pushed the fix/759-datetimeimmutable-constructor branch from 9212305 to 7487888 Compare October 16, 2026 11:38
@shish

shish commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator

Looks good, the tests failing seem unrelated to your changes so I'm not sure why they just started failing now...

…machine#759

The constructor created the parent and the inner \DateTimeImmutable
separately, so relative times like 'now' could differ by microseconds
between the two, breaking diff() and comparisons. Build the inner date
first and initialise the parent from its exact value and timezone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@shish
shish force-pushed the fix/759-datetimeimmutable-constructor branch from 7487888 to d6f421e Compare October 24, 2026 12:48
@shish

shish commented Oct 24, 2026

Copy link
Copy Markdown
Collaborator

Fixed the tests which were broken upstream, all green, merging now, thank you :)

@shish
shish merged commit d25cf9c into thecodingmachine:master Oct 24, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Broken Function: DateTimeImmutable

2 participants