NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Skipping STRICT messages in PHP5?


Joined: 04 Dec 2003
Posts: 27
Location: Portland, OR
Reply with quote
Is it possible (in phpEd 3.3) to break on NOTICE but still ignore STRICT?

It's incredibly tiring to try and debug an app that's PHP4 compatible (and still be able to catch NOTICEs) but not have to sift through hundreds/thousands of "'var' is deprecated" and "new by reference" messages...
View user's profileFind all posts by SigneSend private messageVisit poster's websiteAIM AddressYahoo MessengerMSN MessengerICQ Number
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
A sample with detailed comments would shed more light on the idea Smile
Could you please compose one?
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 04 Dec 2003
Posts: 27
Location: Portland, OR
Reply with quote
I'm not really sure what else there is to say... break on E_NOTICE, don't break on E_STRICT.

Code:

class Foo {

    // don't break on 'var is deprecated' E_STRICT
    var $bar;

    function Foo() {
        // don't break here, on 'new by reference is deprecated' E_STRICT
        $bar =& new Baz();

        // do break here on 'undefined variable $foo' E_NOTICE
        $bar = $foo;
    }
}
View user's profileFind all posts by SigneSend private messageVisit poster's websiteAIM AddressYahoo MessengerMSN MessengerICQ Number
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
Quote:
I'm not really sure what else there is to say... break on E_NOTICE, don't break on E_STRICT

Try to debug without breaking on anything, set a breakpoint on the last statement and analize all the errors collected on the ERRORS tab.
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 04 Dec 2003
Posts: 27
Location: Portland, OR
Reply with quote
ddmitrie wrote:
Quote:
I'm not really sure what else there is to say... break on E_NOTICE, don't break on E_STRICT

Try to debug without breaking on anything, set a breakpoint on the last statement and analize all the errors collected on the ERRORS tab.


How exactly does that help me if I don't know what I'm looking for? Am I supposed to break every ten lines of every single file and re-read the debug output? You wanted an example of what I was asking, which it is. It's hardly a real world scenario.

This is the issue, that I'm sure many people besides me deal with; I develop locally using PHP5. The product is PHP4 compatible. I want to know about things like 'undefined variable'... they're quite important because they shouldn't be occuring. I don't, however, have the slightest care for E_STRICT messages. Now, if I'm running the app through the debugger, and I want to catch E_NOTICEs, I have to break on every E_STRICT as well. I have no choice in the matter because dbg seems to see them as exactly the same thing, in terms of debug levels.

I want to be able to set the debugger to 'Break on errors, warnings and notices' but NOT to break on E_STRICT. Since you have no real answer to the question, I guess it comes down to the fact that phpEd needs a fourth debug level. 'Break on errors, warnings, notices, and stricts'.

php docs wrote:

1 E_ERROR
2 E_WARNING
4 E_PARSE
8 E_NOTICE
16 E_CORE_ERROR
32 E_CORE_WARNING
64 E_COMPILE_ERROR
128 E_COMPILE_WARNING
256 E_USER_ERROR
512 E_USER_WARNING
1024 E_USER_NOTICE
2047 E_ALL
2048 E_STRICT

Warning:
With PHP > 5.0.0 E_STRICT with value 2048 is available. E_ALL does NOT include error level E_STRICT.


E_ALL does not include E_STRICT, because they're erroneous messages. They mean nothing in 99.95% of all cases, especially in a PHP4 compatible script.
View user's profileFind all posts by SigneSend private messageVisit poster's websiteAIM AddressYahoo MessengerMSN MessengerICQ Number
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
Quote:
Am I supposed to break every ten lines of every single file and re-read the debug output?

I didn't mean it.

Quote:
I want to be able to set the debugger to 'Break on errors, warnings and notices' but NOT to break on E_STRICT


IMHO it's better not to break at all, run the script in the debugger and inspect ERRORS tab after the script is finished and check all the E_NOTICEs logged here.
View user's profileFind all posts by dmitriSend private messageVisit poster's website


Joined: 04 Dec 2003
Posts: 27
Location: Portland, OR
Reply with quote
ddmitrie wrote:
Quote:
Am I supposed to break every ten lines of every single file and re-read the debug output?

I didn't mean it.

Quote:
I want to be able to set the debugger to 'Break on errors, warnings and notices' but NOT to break on E_STRICT


IMHO it's better not to break at all, run the script in the debugger and inspect ERRORS tab after the script is finished and check all the E_NOTICEs logged here.


In a real application, that's just not possible to do since the debug output gets reset every time a script starts. So, you run a script with an error, that script performs a redirect, and then the output resets. You can't see the error because it's no longer there.

Breaking on errors is absolutely essential to accurate debugging.

Edit: Not to mention that in a large PHP4-compatible application, it's very likely that you'll have several thousand STRICT errors on the debug tab. It's incredibly difficult to sort through.
View user's profileFind all posts by SigneSend private messageVisit poster's websiteAIM AddressYahoo MessengerMSN MessengerICQ Number
Site Admin

Joined: 13 Jul 2003
Posts: 8344
Reply with quote
I think we'll improve the IDE this way in a next version.
View user's profileFind all posts by dmitriSend private messageVisit poster's website
Skipping STRICT messages in PHP5?
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic