-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Fix ctype_digit deprecation #42074
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 ctype_digit deprecation #42074
Conversation
Thank you @alexpott. |
@@ -161,8 +161,8 @@ public static function dump($value, int $flags = 0): string | ||
return 'true'; | ||
case false === $value: | ||
return 'false'; | ||
case ctype_digit($value): | ||
return \is_string($value) ? "'$value'" : (int) $value; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still need to handle the case of is_string($value) && ctype_digit($value)
, to dump the value quoted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this case is handled L180, isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
indeed, this case should be covered by is_numeric($value)
.
Btw, don't we also have issues when passing floats through is_numeric($value) && false === strpos($value, "\f") && ...
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we could have a case dedicated to is_float I agree
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stof I'm pretty sure that the next case takes care of that already.
Running the Yaml unit tests on PHP 8.1 built: Jul 12 2021 00:22:13 results in the following PHP Notices: