# [Bedrock] Can't disable PHP notices/warnings

**URL:** https://discourse.roots.io/t/bedrock-cant-disable-php-notices-warnings/20511
**Category:** bedrock
**Created:** 2021-04-03T16:36:18Z
**Posts:** 5

## Post 1 by @strarsis — 2021-04-03T16:36:18Z

Although I set everything to false/0 in the `development.php`,  
the PHP notices and warnings are still shown, preventing the proper use of the site.  
How can I disable it for latest Bedrock?

Example notice:

```
ErrorException: Undefined index: default_attributes_xpath in file /srv/www/web/app/plugins/woocommerce-xml-csv-product-import/views/admin/import/product/_tabs/_variations.php on line 855
```

Although the script execution doesn’t stop at that point,  
the page is rendered unusable by the unexpected markup.

Edit: `ErrorException` is handled by `Illuminate\Bootstrap\HandleExceptions`:

```
Illuminate\Foundation\Bootstrap\HandleExceptions-&gt;handleError()
```

The underlying issue is apparently in the `Illuminate/Foundation` package in the exceptions handler  
(`vendor/roots/acorn/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php`:68).

```
/**
     * Convert PHP errors to ErrorException instances.
     *
     * @param int $level
     * @param string $message
     * @param string $file
     * @param int $line
     * @param array $context
     * @return void
     *
     * @throws \ErrorException
     */
    public function handleError($level, $message, $file = '', $line = 0, $context = [])
    {
        if (error_reporting() & $level) {
            throw new ErrorException($message, 0, $level, $file, $line);
        }
    }
```

The bitwise comparison `error_reporting() & $level` doesn’t work with `-1` for `error_reporting()` in order to disable all PHP errors, warnings and notices.  
For example, `E_NOTICE` got value `8` and `-1 & 8` results in `true`.

I also noticed that the `illuminate/foundation` package used by `acorn` is abandoned and its GitHub repository removed:

> **[illuminate/foundation - Packagist](https://packagist.org/packages/illuminate/foundation)**
>
> A web application foundation.

> This package is **abandoned** and no longer maintained. No replacement package was suggested.

Edit: `error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE);` doesn’t work either.

---

## Post 2 by @alwaysblank — 2021-04-05T15:44:34Z

> [@strarsis](#):
>
> `-1` for `error_reporting()` in order to disable all PHP errors, warnings and notices.

Are you saying you’re passing `-1` with the intent to disable all error reporting? The [PHP docs for `error_reporting()`](https://www.php.net/manual/en/function.error-reporting.php) indicate the a value of `-1` _enables_ all error reporting.

---

## Post 3 by @strarsis — 2021-04-05T16:21:29Z

Hm you are right. But with `error_reporting(0)` there is no difference.

---

## Post 4 by @strarsis — 2021-04-21T14:23:56Z

Related issue:

> <https://github.com/roots/acorn/issues/100>
>
> I've read the guidelines for Contributing to Roots Projects
> This request isn't a duplicate of an existing issue
> I've read the...

---

## Post 5 by @system — 2021-05-15T16:36:24Z

This topic was automatically closed after 42 days. New replies are no longer allowed.
