Bug #14736: about error_reporting for $_GET
| From: | Xuefer at 21cn dot com | Date: | Fri, 28 Dec 2001 15:58:15 +0000 |
| Subject: | Bug #14736: about error_reporting for $_GET | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-75189@lists.php.net to get a copy of this message | ||
From: Xuefer@21cn.com
Operating system: all
PHP version: 4.1.1
PHP Bug Type: Feature/Change Request
Bug description: about error_reporting for $_GET
suggest that it should be possible to turn off warnning of undefined index
of $_GET ans $_POST and so on..
example:
such as:
url: http://www.domain.com/index.php
code: <?php echo $_GET['id']; ?>
would cause warnning 'Undefined index'
unless the user must type in http://www.domain.com/index.php?id=123
or.... the code should be changed into:
<?php if (!empty($_GET['id'])) print $_GET['id']; ?>
or maybe:
<?php
$id = empty($_GET['id'])?0:$_GET['id']; // just like register_global ?
.....
echo "id is: $id"; // 'no warnning' for use here
?>
of cause, we can turn off warnning for a running website.
but....how can the web developers bear it when developing ?
it's a 'terrible' warnning message that we don't want, we should have our
attentions to those warnning about variables like $foo['bar'] not
$_GET['id'] nor $_POST['username']
--
Edit bug report at: http://bugs.php.net/?id=14736&edit=1