For Programmers: Free Programming Magazines  


Home > Archive > PHP Programming > March 2008 > simple error reporting question









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author simple error reporting question
Mike

2008-03-11, 7:08 pm

Hi,

I have set:

error_reporting = E_ALL & E_WARNING | E_STRICT
display_error = ON

This should send errors and warnings to stdout.
I never see any errors or warnings.
I assume stdout is the browser window, is that correct?

Thanks,
Mike

ZeldorBlat

2008-03-11, 7:08 pm

On Mar 11, 12:49 pm, Mike <j...@sbcglobal.net> wrote:
> Hi,
>
> I have set:
>
> error_reporting = E_ALL & E_WARNING | E_STRICT
> display_error = ON
>
> This should send errors and warnings to stdout.
> I never see any errors or warnings.
> I assume stdout is the browser window, is that correct?
>
> Thanks,
> Mike


E_ALL & E_WARNING is the equivalent of E_WARNING. Given what you have
above you should see warnings and strict notices but nothing else.
What you really want is probably this:

E_ALL | E_STRICT

Do you have an example of some code that should throw an error but
doesn't?
Ivan Marsh

2008-03-11, 7:08 pm

On Tue, 11 Mar 2008 10:01:19 -0700, ZeldorBlat wrote:

> On Mar 11, 12:49 pm, Mike <j...@sbcglobal.net> wrote:
>
> E_ALL & E_WARNING is the equivalent of E_WARNING. Given what you have
> above you should see warnings and strict notices but nothing else. What
> you really want is probably this:
>
> E_ALL | E_STRICT
>
> Do you have an example of some code that should throw an error but
> doesn't?


What does E_STRICT do? I run E_ALL on my servers.

--
"Remain calm, we're here to protect you!"

Rik Wasmus

2008-03-11, 7:08 pm

On Tue, 11 Mar 2008 18:14:51 +0100, Ivan Marsh <annoyed@you.now> wrote:

> On Tue, 11 Mar 2008 10:01:19 -0700, ZeldorBlat wrote:
>
N[color=darkred]
rs[color=darkred]
e[color=darkred]
at[color=darkred]
>
> What does E_STRICT do? I run E_ALL on my servers.


It warns about problems not necessarily influencing outcome, but that ar=
e =

either bad form or deprecated.

Examples (from PEAR):
- Methods that are intended to be called statically should be defined wi=
th =

static keyword
- The $foo =3D& new Foo construct should not be used
- instanceof operator should be used instead of is_a() function
- Declarations of methods in child classes should be compatible with tho=
se =

in parent classes
-- =

Rik Wasmus
Mike

2008-03-11, 7:08 pm

Ivan Marsh wrote:
> On Tue, 11 Mar 2008 10:01:19 -0700, ZeldorBlat wrote:
>
>
> What does E_STRICT do? I run E_ALL on my servers.
>

Zeldor,

No, I currently do not have a piece of code, that I know should throw an
error. So far, when I create an error I just get a blank browser screen.
I am a bit surprised I have not seen something, since I am very new to
this and I am really hacking at it for the moment.

Ivan,

I think E_STRICT forces more strict coding practices, for example you
might get a warning for not initializing variables (at least that is
what strict does in something like PERL)

Mike
Rik Wasmus

2008-03-11, 7:08 pm

On Tue, 11 Mar 2008 18:29:58 +0100, Mike <junk@sbcglobal.net> wrote:
> Ivan Marsh wrote:
ON[color=darkred]
ors[color=darkred]
ve[color=darkred]
hat[color=darkred]

[color=darkred]
> So far, when I create an error I just get a blank browser screen.


Well, if they are syntax error, any display_errors setting in the file i=
s =

ignored. Setting the correct error_reporting level and display_errors =

should go in (in order of desirability):
- php.ini
- or webserver configuration (httpd.conf for apache)
- in a per directory configuration (.htaccess for apache)
- only then in the script itself (which is unreliable).

> I am a bit surprised I have not seen something, since I am very new to=

=

> this and I am really hacking at it for the moment.


Well, PHP is pretty loose, so if you're allready accustomed to programmi=
ng =

you won't create errors that fast as in stricter languages.
-- =

Rik Wasmus
AnrDaemon

2008-03-31, 8:09 pm

Greetings, Rik Wasmus.
In reply to Your message dated Tuesday, March 11, 2008, 22:52:40,

> If you do alter it with the php.ini, check with error_reporting() what the
> current level is, and possibly with phpinfo() which ini file it actually
> uses (and as always, restart the webserver after making any changes to
> php.ini).


For me, PHP produce very strange info about PHP.ini beeing used.
For the times back it was pure lie about the php.ini location.
ATM it is

Configuration File (php.ini) Path C:\WINDOWS
(While I have it set in httpd.conf to C:\usr\sbin\php-5.2.2-Win32)
Loaded Configuration File C:\usr\sbin\php-5.2.2-Win32\php.ini
(Which is pure truth)

I'm using PHP as apache module,


--
Sincerely Yours, AnrDaemon <anrdaemon@freemail.ru>

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com