laravel-debugbar icon indicating copy to clipboard operation
laravel-debugbar copied to clipboard

Feature: add an option to disable deprecation warnings, or set a custom error_reporting level

Open mauriziofonte opened this issue 2 years ago • 0 comments

Hello all,

I've got a feature request to suggest: add an option to disable deprecation warnings, or set a custom error_reporting level.

This is expecially useful for new PHP 8.2 projects where the codebase is heavily using Dynamic Properties.

I couldn't find anywhere else such an option: i've had a look at the source code to see how the option error_handler is used, but the only thing it does is to set the error handler to LaravelDebugBar::handleError():

File: vendor/barryvdh/laravel-debugbar/src/LaravelDebugbar.php

Source:

// Set custom error handler
if ($app['config']->get('debugbar.error_handler', false)) {
        set_error_handler([$this, 'handleError']);
}

I think it should become:

// Set custom error handler
if ($app['config']->get('debugbar.error_handler', false)) {
        // get the error_level config
        $level = $app['config']->get('debugbar.error_level', E_ALL);
        
        // call our handleError with $level
        set_error_handler([$this, 'handleError'], $level);
}

Side note: I've modified my codebase using #[AllowDynamicProperties] on all classes using Dynamic Properties as suggested on deprecate_dynamic_properties RFC. Debugbar still catch this errors. Also tried to error_reporting(E_ALL & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED); on AppProvider, but with no success.

mauriziofonte avatar Jan 04 '23 10:01 mauriziofonte