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

Ignore/hide Notices in logs using error_reporting() #1080

Open
kripper opened this issue Nov 8, 2022 · 2 comments
Open

Ignore/hide Notices in logs using error_reporting() #1080

kripper opened this issue Nov 8, 2022 · 2 comments

Comments

@kripper
Copy link
Contributor

kripper commented Nov 8, 2022

Is there any option to ignore/hide the Notices (showing in VSCode debug window)?
This code should work:

error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_STRICT);

@kripper kripper changed the title is_dir() not accessing ContentPath? Ignore/hide the Notices with error_reporting() Nov 8, 2022
@kripper kripper changed the title Ignore/hide the Notices with error_reporting() Ignore/hide Notices in logs using error_reporting() Nov 8, 2022
@jakubmisek
Copy link
Member

we're reporting everything to Debug Output window in .NET

@kripper
Copy link
Contributor Author

kripper commented Nov 8, 2022

Right. And I believe this also goes all to the logs even on production which is a problem when you have millions of unwanted notices and you don't want to spend months adapting legacy code (specially when it's not yours) or when having undefined variables is your coding style choice and the reason you love PHP.

BTW, there is a flame war in the PHP community regarding the imposed coding style since version 8:

About 40% of the developers considered it a bad decision, very disrespectful and/or that PHP's simplicity was destroyed. As a workaround, some developers suggested 1) to disable logging notices using error_reporting(E_ALL ^ E_NOTICE ^ E_DEPRECATED ^ E_STRICT) and 2) to create your own error handler and ignore specific warnings that were previously handled as notices.

This workaround is not working in Peachpie, becauses 1) error_reporting didn't affect the logs and 2) it is ignoring the value returned by the error handler function, where returning true means "ignore the error completely and don't even log it".

My suggestion is to implement both to avoid forks, because even when 60% is bigger than 40%, that's not a reason to crash them (force them to rewrite their legacy code instead of simply solve it with a single configuration option).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants