Re: error_reporting (E_ALL);
Andy Hassall <andy@andyh.co. uk> wrote or quoted:[color=blue]
> On Fri, 21 Nov 2003 14:22:34 GMT, Tim Tyler <tim@tt1lock.or g> 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.
error_reporting (E_ALL);
Collapse
This topic is closed.
X
X
-
Guest replied -
Guest repliedRe: error_reporting (E_ALL);
On Fri, 21 Nov 2003 14:22:34 GMT, Tim Tyler <tim@tt1lock.or g> 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)
Leave a comment:
-
Guest repliedRe: error_reporting (E_ALL);
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
Leave a comment:
-
Guest repliedRe: error_reporting (E_ALL);
On 21-Nov-2003, Tim Tyler <tim@tt1lock.or g> 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
tom (at) creative (dash) light (dot) com
do NOT send email to jamesbutler@wil lglen.net (it's reserved for spammers)
Leave a comment:
-
Guest repliedRe: error_reporting (E_ALL);
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.
Regards,
Shawn
--
Shawn Wilson
shawn@glassgian t.com
Leave a comment:
-
Guest repliedRe: error_reporting (E_ALL);
[Fri, 21 Nov 2003 14:22:34 GMT] Tim Tyler <tim@tt1lock.or g> 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_global s turned off?
What warning exactly was it? Or was it a notice?
Leave a comment:
-
error_reporting (E_ALL);
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.
Leave a comment: