[5.x] Fix emptiness check on Value properties #11402
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Tricky behavior ran into by Erin - https://discord.com/channels/489818810157891584/489830535565148169/1333967156861468694
This won't directly solve what he was dealing with (as he had a custom class), but it will fix it for future devs checking if a property on a Value is empty.
Currently, if you have an object wrapped by a Value and then check the emptiness of a property on that object it returns true no matter what:
This is due to https://www.php.net/manual/en/function.empty.php#99959
In other words, since Value doesn't have the
__isset()
method on it every singleempty()
check on a property inside of it will fail.This PR fixes that and adds a test :)