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

Always append empty values to dropdowns with invalid data #10373

Merged
merged 3 commits into from
Jan 18, 2022

Conversation

timkelty
Copy link
Contributor

Description

Fixes #10365, being careful not to break #3844

@@ -239,11 +239,12 @@ public function normalizeValue($value, ElementInterface $element = null)
}

if (is_string($value) && (
$value === '' ||
strpos($value, '[') === 0 ||
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removing this allows $value to remain '' instead of being coerced to null.

strpos($value, '[') === 0 ||
strpos($value, '{') === 0
)) {
$value = Json::decodeIfJson($value);
} else if ($value === '' && $this->multi) {
$value = [];
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This ensures we don't brake the fix from #3844

@timkelty timkelty requested a review from brandonkelly January 17, 2022 21:56
@brandonkelly brandonkelly merged commit d70a84b into develop Jan 18, 2022
@brandonkelly brandonkelly deleted the fix-invalid-dropdown-values branch January 18, 2022 18:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Invalid dropdown values don't provide blank option if a default is set
2 participants