-
-
Notifications
You must be signed in to change notification settings - Fork 437
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
Ensure count() is not called on a string #2888
Ensure count() is not called on a string #2888
Conversation
Why not simply this? if (preg_match('/^(\w+)\[(\w+)\]$/', $fileId, $file)) { If the statement is true then |
Instead of checking the results of preg_match by counting the length of the string, simply check for the success value. This prevents PHP 8.1 deprecation warnings.
31f75b0
to
3ec2e39
Compare
Code updated. Thanks everyone for the feedback! |
Instead of checking the results of preg_match by counting the length of the string, simply check for the success value. This prevents PHP 8.1 deprecation warnings.
cherry-picked to 20.0 since there were no conflicts |
This PR fixes the PHP 8.1 deprecation warning on
setUploadFileId
by checking the existence ofpreg_match
values usingisset()
rather thancount()
which is now deprecated for string types.