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

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

Open
mauriziofonte opened this issue Jan 4, 2023 · 0 comments

Comments

@mauriziofonte
Copy link

mauriziofonte commented Jan 4, 2023

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.

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

1 participant