Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: "Could not convert PHP value of type DateTime to type date_immutable" during ./flow site:import #5248

Open
1 task done
grebaldi opened this issue Sep 16, 2024 · 0 comments · May be fixed by #5249
Open
1 task done
Assignees
Labels

Comments

@grebaldi
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

When importing site contents from a Sites.xml file via ./flow site:import, the following exception occurs:

Exception #1300360480 in line 99 of [...]/Framework/Neos.Flow/Classes/ObjectManagement/DependencyInjection/DependencyProxy.php: Error: During import an exception occurred: "Could not convert PHP value of type DateTime to type date_immutable. Expected one of the following types: null, DateTimeImmutable".

This is due to

$dateValue = $this->propertyMapper->convert($stringValue, 'DateTime', $this->propertyMappingConfiguration);

When the Sites.xml contains <creationDateTime/> or <lastModificationDateTime/> elements, the property mapper is instructed to convert them to DateTime rather than DateTimeImmutable objects.

Expected Behavior

The importer should convert <creationDateTime/> , <lastModificationDateTime/> and any other date/time to \DateTimeImmuable rather than \DateTime.

Steps To Reproduce

Run ./flow site:import on a site export (presumably one that has been done with Neos 8.3 or earlier) in a Neos 8.4 setup. Make sure doctrine/dbal@3.* is installed. The error should show up in that environment.

Environment

- Flow: 8.4
- Neos: 8.4
- PHP: 8.2

I suspect the error didn't show prior to Neos/Flow 8.4, because of 8.4 pulling in `doctrine/dbal@3.*` rather than `doctrine/dbal@2.*`.

Anything else?

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant