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 1 commit into from Jul 30, 2022


Copy link

@othercorey othercorey commented Jul 29, 2022

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 Jul 29, 2022
@@ -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

@markstory markstory Jul 30, 2022

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
12 of 13 checks passed
@markstory markstory deleted the fix-int-param branch Jul 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet

Successfully merging this pull request may close these issues.

None yet

2 participants