Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Typed property and empty data (php 7.4) #37377

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

Closed
adpeyre opened this issue Jun 22, 2020 · 2 comments
Closed

Typed property and empty data (php 7.4) #37377

adpeyre opened this issue Jun 22, 2020 · 2 comments

Comments

@adpeyre
Copy link
Contributor

adpeyre commented Jun 22, 2020

Symfony version(s) affected: 5.1.0

Description
My class has a typed property. Empty value for this property in the submitted form shouldn't be converted to null.

What do you think about that ?

How to reproduce

public string $title = '';

Type property App\Entity\MyEntity::$title must be a string, null used.

@xabbuh
Copy link
Member

xabbuh commented Jun 22, 2020

This looks expected to me. User submitted data are inherently invalid. The underlying data structure needs to adapt for that. I see several options:

@xabbuh
Copy link
Member

xabbuh commented Jun 25, 2020

closing as explained above

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

No branches or pull requests

3 participants