Skip to content

[Config] Fix using null values with config builders #45789

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

Merged
merged 1 commit into from
Mar 22, 2022

Conversation

HypeMC
Copy link
Contributor

@HypeMC HypeMC commented Mar 19, 2022

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets Fix #45782
License MIT
Doc PR -

The generated config builders will no longer discard null values.

*/
class ReceivingConfig
{
private $priority;
private $color;
private $_usedProperties = [];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we don't use underscores in property names

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nicolas-grekas This is to avoid collision with configuration proprieties (->scalarNode('used_properties')), same as with _extraKeys.

Sorry, I accidentally resolved this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it, thanks for the explanation.

$this->scalarNode = $value['scalar_node'];
unset($value['scalar_node']);
}

if (isset($value['scalar_node_with_default'])) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this use array_key_exists to allow passing null ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HypeMC HypeMC force-pushed the fix-null-in-config-builder branch from e214761 to 1264225 Compare March 21, 2022 13:42
@nicolas-grekas
Copy link
Member

Thank you @HypeMC.

@nicolas-grekas nicolas-grekas merged commit 6afaa8c into symfony:5.4 Mar 22, 2022
@HypeMC HypeMC deleted the fix-null-in-config-builder branch March 22, 2022 15:37
This was referenced Apr 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants