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

Bitwise operators used agains Arrays #401

Closed
pszalko opened this issue Feb 1, 2017 · 3 comments
Closed

Bitwise operators used agains Arrays #401

pszalko opened this issue Feb 1, 2017 · 3 comments

Comments

@pszalko
Copy link

pszalko commented Feb 1, 2017

I wonder why there are bitwise operators used against int and array types?
Result of such comparison is almost always false.

Here is an example from lib/Raven/ErrorHandler.php:122

        if ($error['type'] & $this->fatal_error_types) {
            $e = new ErrorException(
                @$error['message'], 0, @$error['type'],
                @$error['file'], @$error['line']
            );
            $this->handleException($e, true);
        }

I assume it causes that handleFatalError() method does not work as expected.

@dcramer
Copy link
Member

dcramer commented Feb 1, 2017

@pszalko at a glance this does seem like it would be broken. I will try to take a look today to confirm and get a fix in.

@dcramer
Copy link
Member

dcramer commented Feb 3, 2017

I was trying to write an actual test for this function (which has been the biggest problem all along), but its seemingly not doable. At the very least I abstracted out the code which performs the check and we have tests now.

@dcramer dcramer closed this as completed in 621378f Feb 3, 2017
dcramer added a commit that referenced this issue Feb 3, 2017
Correct handling of fatal errors (fixes GH-401)
@dcramer
Copy link
Member

dcramer commented Feb 3, 2017

I pushed out 1.6.2 which contains this fix

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

No branches or pull requests

2 participants