Could not convert PHP value of type 'DateTimeImmutable' to type 'datetime' #4995

Closed
opened 2026-01-22 14:56:09 +01:00 by admin · 5 comments
Owner

Originally created by @bazo on GitHub (Jan 28, 2016).

Originally assigned to: @Ocramius on GitHub.

hi,

i've been using DateTimeImmutable for some time now as parameters to query builder queries, dql queries and also in entity values

in one project there's a code more than a year old that uses DateTimeImmutable and it worked all the time.

but after some update of doctrine in the past few days this error started popping up

Could not convert PHP value of type 'DateTimeImmutable' to type 'datetime'. Expected one of the following types: null, DateTime

i remember this was in issue when php 5.5 was new, so this seems like regression to me

Originally created by @bazo on GitHub (Jan 28, 2016). Originally assigned to: @Ocramius on GitHub. hi, i've been using DateTimeImmutable for some time now as parameters to query builder queries, dql queries and also in entity values in one project there's a code more than a year old that uses DateTimeImmutable and it worked all the time. but after some update of doctrine in the past few days this error started popping up Could not convert PHP value of type 'DateTimeImmutable' to type 'datetime'. Expected one of the following types: null, DateTime i remember this was in issue when php 5.5 was new, so this seems like regression to me
admin added the BugInvalid labels 2026-01-22 14:56:09 +01:00
admin closed this issue 2026-01-22 14:56:09 +01:00
Author
Owner

@bazo commented on GitHub (Jan 28, 2016):

stable 2.5.4 does not have this bug

@bazo commented on GitHub (Jan 28, 2016): stable 2.5.4 does not have this bug
Author
Owner

@Jean85 commented on GitHub (Feb 8, 2016):

Which version where you using when reproducing the bug?

@Jean85 commented on GitHub (Feb 8, 2016): Which version where you using when reproducing the bug?
Author
Owner

@Ocramius commented on GitHub (Feb 8, 2016):

Since it doesn't concern the current stable version, closing as invalid

@Ocramius commented on GitHub (Feb 8, 2016): Since it doesn't concern the current stable version, closing as `invalid`
Author
Owner

@teohhanhui commented on GitHub (Jun 23, 2016):

@Ocramius You forgot to close this... 😄

@teohhanhui commented on GitHub (Jun 23, 2016): @Ocramius You forgot to close this... :smile:
Author
Owner

@Ocramius commented on GitHub (Jul 5, 2016):

@teohhanhui don't drink and review! 🍻 Thanks for the ping :)

@Ocramius commented on GitHub (Jul 5, 2016): @teohhanhui don't drink and review! 🍻 Thanks for the ping :)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#4995