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

Xor operation on strings on PHP 7.x is viewed as conversion to int #8094

nach-code opened this issue Oct 2, 2022 · 1 comment


Copy link

PHP allows strings to be xor'd. From:

If both operands for the &, | and ^ operators are strings, then the operation will be performed on the ASCII values of the characters that make up the strings and the result will be a string. In all other cases, both operands will be converted to integers and the result will be an integer.

However, when this is done, PHPStan on PHP 7.x now thinks the string has been converted into an integer.

The output should not have errors here, but PHPStan thinks that the string is now an int, that cannot be passed to base64_encode: Parameter #1 $str of function base64_encode expects string, int given.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

3 participants