By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,731 Members | 1,123 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,731 IT Pros & Developers. It's quick & easy.

error_reporting (E_ALL);

P: n/a
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/ ti*@tt1lock.org Remove lock to reply.
Jul 17 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
[Fri, 21 Nov 2003 14:22:34 GMT] Tim Tyler <ti*@tt1lock.org> wrote:
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?


Do you have register_globals turned off?

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

Jul 17 '05 #2

P: n/a
Tim Tyler wrote:

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/ ti*@tt1lock.org Remove lock to reply.


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
sh***@glassgiant.com
http://www.glassgiant.com
Jul 17 '05 #3

P: n/a

On 21-Nov-2003, Tim Tyler <ti*@tt1lock.org> wrote:
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?
-


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 ja*********@willglen.net (it's reserved for spammers)
Jul 17 '05 #4

P: n/a
Tim Tyler wrote:
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?


<?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

P: n/a
On Fri, 21 Nov 2003 14:22:34 GMT, Tim Tyler <ti*@tt1lock.org> wrote:
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?


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 (an**@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

P: n/a
Andy Hassall <an**@andyh.co.uk> wrote or quoted:
On Fri, 21 Nov 2003 14:22:34 GMT, Tim Tyler <ti*@tt1lock.org> wrote:

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?


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.


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/ ti*@tt1lock.org Remove lock to reply.
Jul 17 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.