364,088 Members | 5483 Browsing Online
Community for Developers & IT Professionals
Bytes IT Community

error_reporting (E_ALL);

Tim Tyler
P: n/a
Tim Tyler
I've been experimenting with using:

error_reporting (E_ALL);

However, lines like this report problems when the variable is missing:

$open = $_GET['open'];

Is there some way to do that with error reporting left turned on -
that *doesn't* give a warning?
--
__________
|im |yler http://timtyler.org/ tim@tt1lock.org Remove lock to reply.
Jul 17 '05 #1
Share this Question
Share on Google+
6 Replies


billy chan
P: n/a
billy chan
[Fri, 21 Nov 2003 14:22:34 GMT] Tim Tyler <tim@tt1lock.org> wrote:[color=blue]
> error_reporting (E_ALL);
>
> However, lines like this report problems when the variable is missing:
> $open = $_GET['open'];
>
> Is there some way to do that with error reporting left turned on -
> that *doesn't* give a warning?[/color]

Do you have register_globals turned off?

What warning exactly was it? Or was it a notice?

Jul 17 '05 #2

Shawn Wilson
P: n/a
Shawn Wilson
Tim Tyler wrote:[color=blue]
>
> I've been experimenting with using:
>
> error_reporting (E_ALL);
>
> However, lines like this report problems when the variable is missing:
>
> $open = $_GET['open'];
>
> Is there some way to do that with error reporting left turned on -
> that *doesn't* give a warning?
> --
> __________
> |im |yler http://timtyler.org/ tim@tt1lock.org Remove lock to reply.[/color]

This will give you all error reports EXCEPT notices (which is what I get with an
undeclared variable).

error_reporting (E_ALL ^ E_NOTICE);

For more info, check out the following URL. You can just turn on specific
warning types by using the "|" to seperate them.

http://ca.php.net/manual/en/function...-reporting.php

Regards,
Shawn
--
Shawn Wilson
shawn@glassgiant.com
http://www.glassgiant.com
Jul 17 '05 #3

Tom Thackrey
P: n/a
Tom Thackrey

On 21-Nov-2003, Tim Tyler <tim@tt1lock.org> wrote:
[color=blue]
> I've been experimenting with using:
>
> error_reporting (E_ALL);
>
> However, lines like this report problems when the variable is missing:
>
> $open = $_GET['open'];
>
> Is there some way to do that with error reporting left turned on -
> that *doesn't* give a warning?
> -[/color]

if (isset($_GET['open']))
$open = $_GET['open'];
else
$open = NULL;

or

$open = (isset($_GET['open'])) ? $_GET['open'] : NULL;

--
Tom Thackrey
www.creative-light.com
tom (at) creative (dash) light (dot) com
do NOT send email to jamesbutler@willglen.net (it's reserved for spammers)
Jul 17 '05 #4

Pedro Graca
P: n/a
Pedro Graca
Tim Tyler wrote:[color=blue]
> I've been experimenting with using:
>
> error_reporting (E_ALL);
>
> However, lines like this report problems when the variable is missing:
>
> $open = $_GET['open'];
>
> Is there some way to do that with error reporting left turned on -
> that *doesn't* give a warning?[/color]

<?php
if (isset($_GET['open'] && (int)$_GET['open']>0)
// don't let users put anything but integers in $open !
$open = (int)$_GET['open'];
else
$open = 0; // 0 means bad input
?>

--
..sig
Jul 17 '05 #5

Andy Hassall
P: n/a
Andy Hassall
On Fri, 21 Nov 2003 14:22:34 GMT, Tim Tyler <tim@tt1lock.org> wrote:
[color=blue]
>I've been experimenting with using:
>
> error_reporting (E_ALL);
>
>However, lines like this report problems when the variable is missing:
>
> $open = $_GET['open'];
>
>Is there some way to do that with error reporting left turned on -
>that *doesn't* give a warning?[/color]

As well as the checks with isset posted by others, there's:

$open = @$_GET['open'];

But only if NULL is an acceptable value for you to use.

--
Andy Hassall (andy@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Jul 17 '05 #6

Tim Tyler
P: n/a
Tim Tyler
Andy Hassall <andy@andyh.co.uk> wrote or quoted:[color=blue]
> On Fri, 21 Nov 2003 14:22:34 GMT, Tim Tyler <tim@tt1lock.org> wrote:[/color]
[color=blue][color=green]
>>I've been experimenting with using:
>>
>> error_reporting (E_ALL);
>>
>>However, lines like this report problems when the variable is missing:
>>
>> $open = $_GET['open'];
>>
>>Is there some way to do that with error reporting left turned on -
>>that *doesn't* give a warning?[/color]
>
> As well as the checks with isset posted by others, there's:
>
> $open = @$_GET['open'];
>
> But only if NULL is an acceptable value for you to use.[/color]

I guess if the syntax sugar is there anyway, you might as well use it.

Thanks very much to those who responded - it's appreciated.
--
__________
|im |yler http://timtyler.org/ tim@tt1lock.org Remove lock to reply.
Jul 17 '05 #7

Post your reply

Help answer this question



Didn't find the answer to your PHP question?

You can also browse similar questions: PHP (e_all) e_all