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

Testing phperror.net #4

Open
MZAWeb opened this issue Nov 23, 2012 · 12 comments
Open

Testing phperror.net #4

MZAWeb opened this issue Nov 23, 2012 · 12 comments

Comments

@MZAWeb
Copy link

MZAWeb commented Nov 23, 2012

Test code: https://gist.github.com/4136893

Without phperror.net script, it doesn't show the notice and warning, but dies on the fatal (which I think it's the intended behaviour).

With phperror.net, unfortunately still dies with the notice.

@tollmanz
Copy link
Owner

Thanks Daniel! I think that fatal errors cannot be stopped, but that is a good thing (at least I think it is). If a plugin is fataling, you need to know that. This plugin should basically "clean up" the error reporting so that you can more easily spot errors related to code that you are working on.

As such, I think this is the expected result.

Can you give it a try with non-fatal errors? This scenario would interest me:

Plugin A: has notices, but is set to NOT show notices. Are notices hidden?
Plugin B: has notices, but is set to show notices. Are the notices shown properly with the phperror.net script?

If that is working, then all is good.

I appreciate you helping out with this!

On Friday, November 23, 2012 at 11:17 AM, Daniel Dvorkin wrote:

Test code: https://gist.github.com/4136893
Without phperror.net (http://phperror.net) script, it doesn't show the notice and warning, but dies on the fatal (which I think it's the intended behaviour).
With phperror.net (http://phperror.net), unfortunately still dies with the notice.


Reply to this email directly or view it on GitHub (#4).

@MZAWeb
Copy link
Author

MZAWeb commented Nov 23, 2012

Agreed on fatals. And I'm on the fence with warnings. Ignoring them could end up biting you in the arse. But totally get the raison d'etre of this and it was really needed! So props on doing it.

It works as it should without phperror.net. While using phperror.net your plugin becomes ineffective, as much as the notices are still showing as if you're plugin wasn't there.

@tollmanz
Copy link
Owner

Thanks! Good to know! I thought it might work given that it works flawlessly with Xdebug which overrides the error reporting. I guess this gives me a good reason to test out phperror.net! There is a lot to the set_error_handler function, so I need to do some more playing around. I think I might just need to store the original error handler, then reset it if an error should display or something like that.

It also still allows errors to display in Debug Bar, so this issue may be related to #1.

On Friday, November 23, 2012 at 11:59 AM, Daniel Dvorkin wrote:

Agreed on fatals. And I'm on the fence with warnings. Ignoring them could end up biting you in the arse. But totally get the raison d'etre of this and it was really needed! So props on doing it.
It works as it should without phperror.net (http://phperror.net). While using phperror.net (http://phperror.net) your plugin becomes ineffective, as much as the notices are still showing as if you're plugin wasn't there.


Reply to this email directly or view it on GitHub (#4 (comment)).

@MZAWeb
Copy link
Author

MZAWeb commented Nov 23, 2012

Well, I guess most users of this plugin will also use Debug Bar (and I hope phperror.php because it kick ass), so it's not minor.

phperror does some funky things. In the 3.4.2 admin is throwing a lot of strict notices (which core deactivates by default), so it's probably ignoring php config and doing it's own thing. Because of that, they have in the setup options a 'wordpress' => true option (https://github.com/JosephLenton/PHP-Error/wiki/Options). Maybe checking what this option does will show you the way.

@tollmanz
Copy link
Owner

Good idea! I'll look!

Definitely don't see it as trivial especially as there are likely other similar scripts that override the default error reporting.

@MZAWeb
Copy link
Author

MZAWeb commented Nov 23, 2012

Skype me @ MZAWeb if you need me to test anything

Cheers

@tollmanz
Copy link
Owner

tollmanz commented Dec 5, 2012

Which of the methods of initiating phperror.net do you use? I'm having a heck of a time getting this plugin to work with it. I installed phperror.net and do see that it is a marvelous thing, but it's nearly useless without being able to silence some errors. As such, I'd like to get this working for it.

@MZAWeb
Copy link
Author

MZAWeb commented Dec 5, 2012

I'm just adding

require( ABSPATH . '/php_error.php' );
\php_error\reportErrors(array('wordpress'=>true));

at the top of my functions.php

I must say, I'm starting to like its unforgiveness. It forces me to deal early with notices both in my code and in the third party plugins I'm using. Having said that, I can see some sites where being able to mute some plugins would be priceless.

I need to run now, but I'll take a stab at it tonight, to see if I can help.

@MZAWeb
Copy link
Author

MZAWeb commented Dec 6, 2012

Got to play with this for a bit and I have a working version... not really pretty, though. Sending you a pull request so you can take a look.

As I guess you don't want to ship php_error.net code inside your plugin, it needs for you to require( 'php_error.php' ) before the Struthio_Camelus __construct (i just included it at the top of the __construct for testing)

@tollmanz
Copy link
Owner

tollmanz commented Dec 6, 2012

Awesome! I'll take a look.

Have you considered setting up a plugin that enables phperror.net? If so, I would SO be willing to work with you to make sure Ostrichcize plays nice with it.

@MZAWeb
Copy link
Author

MZAWeb commented Dec 6, 2012

Making a plugin should be easy and quick. Will take a stab tomorrow.

@MZAWeb
Copy link
Author

MZAWeb commented Dec 12, 2012

Hey, sorry, complicated week.

Really quick first pass, but gets the job done: https://github.com/MZAWeb/wp-phperror-net

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

2 participants