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

Error handler: incorrect bitwise comparison #100

Closed
4 tasks done
strarsis opened this issue Apr 5, 2021 · 1 comment · Fixed by #122
Closed
4 tasks done

Error handler: incorrect bitwise comparison #100

strarsis opened this issue Apr 5, 2021 · 1 comment · Fixed by #122

Comments

@strarsis
Copy link
Contributor

strarsis commented Apr 5, 2021

Description

Note: acorn put the code of a previously deprecated package (on packagist) into its own repo.

There is a bug with the bitwise operation used in the condition to check for error_reporting as it doesn't work for disabled error_reporting or error_reporting without lower reporting levels:

if (error_reporting() & $level) {

with error_reporting set to 0 or E_ERROR | E_WARNING | E_PARSE in order to skip E_NOTICE PHP errors,
the error will still be thrown, shown and destroy the page markup at that point with injected "rich" error HTML.

Steps to reproduce

  1. Configure for lower or none error_reporting, e.g. for staging in config/environments/staging.php
  2. Trigger a PHP E_NOTICE message, e.g. an Undefined index error by accessing an undefined index of a PHP array:
    Note that these lower level PHP errors still cause a "rich" HTML error message, which shouldn't happen.

Expected behavior:
PHP errors with levels to be ignored.

Actual behavior:
PHP errors with levels to be ignored are still thrown.

Reproduces how often:
Always.

Versions

Bedrock:

### 1.15.3: 2021-03-12
* chore(deps): Bump roots/wordpress from 5.6.2 to 5.7 ([#578](https://github.com/roots/bedrock/pull/578))

Additional information

Related: #87

@QWp6t
Copy link
Sponsor Member

QWp6t commented Oct 30, 2021

This is intentional.

By default, deprecation errors won't throw exceptions, but every other type of error will.

If you want to suppress throwing ErrorException, use the acorn/throw_error_exception filter on the next branch.

add_filter('acorn/throw_error_exception', '__return_false');

We will be tagging another beta release shortly. In the meantime, feel free to switch to the next branch.

composer require roots/acorn dev-next

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

Successfully merging a pull request may close this issue.

2 participants