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

Fix string to int action parameter coercion failing for '0' #16658

Merged
merged 1 commit into from Jul 30, 2022

Conversation

othercorey
Copy link
Member

Fixes bug introduced in #16643

@othercorey othercorey added this to the 4.4.3 milestone Jul 29, 2022
@othercorey othercorey marked this pull request as ready for review July 29, 2022 22:18
@@ -268,7 +268,7 @@ protected function coerceStringToType(string $argument, ReflectionNamedType $typ
case 'float':
return is_numeric($argument) ? (float)$argument : null;
case 'int':
return filter_var($argument, FILTER_VALIDATE_INT) ? (int)$argument : null;
return filter_var($argument, FILTER_VALIDATE_INT, FILTER_NULL_ON_FAILURE);
Copy link
Member

Choose a reason for hiding this comment

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

Oof, I totally forgot about 0 failing the ternary here 😢

@markstory markstory merged commit 923f04a into 4.x Jul 30, 2022
@markstory markstory deleted the fix-int-param branch July 30, 2022 02:01
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.

None yet

2 participants