Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Validator] fix access to uninitialized property when getting value#35532
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Uh oh!
There was an error while loading.Please reload this page.
fabpot commentedJan 31, 2020
Thank you@greedyivan. |
…ing value (greedyivan)This PR was squashed before being merged into the 3.4 branch (closes#35532).Discussion----------[Validator] fix access to uninitialized property when getting value| Q | A| ------------- | ---| Branch? | 3.4| Bug fix? | yes| New feature? | no| Deprecations? | no| Tickets |Fix#35454| License | MIT| Doc PR |In PHP 7.4, the type-hinted property is [uninitialized](https://wiki.php.net/rfc/typed_properties_v2#uninitialized_and_unset_properties) by default. So it needs to be checked before use.Commits-------1edecf7 [Validator] fix access to uninitialized property when getting value
realjjaveweb commentedFeb 21, 2024
@nicolas-grekas Hi, would you mind please documenting this also here: Because there's not name of Constraint that would imply check for uninitialized property, so people often times just use Which is completely fine since this commit/MR merged but it's not documented anywhere - or at least I didn't find it anywhere in the docs. |
In PHP 7.4, the type-hinted property isuninitialized by default. So it needs to be checked before use.