#14736 [Opn->]: about error_reporting for $_GET
| From: | philip@php.net | Date: | Wed, 04 Dec 2002 17:34:32 +0000 |
| Subject: | #14736 [Opn->]: about error_reporting for $_GET | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-26640@lists.php.net to get a copy of this message | ||
ID: 14736
Updated by: philip@php.net
Reported By: Xuefer@21cn.com
-Status: Open
+Status: Won\'t fix
Bug Type: Feature/Change Request
Operating System: all
PHP Version: 4.1.1
New Comment:
This is already possible with @.
print @$_GET['id'];
Regardless, autoglobals should still report undefined indices, I don't
see any advantage in not reporting them but only the introduction of
inconsistencies. This will never change, marking as "Won\'t fix".
See also: array_key_exists().
Previous Comments:
------------------------------------------------------------------------
[2001-12-28 10:58:15] Xuefer@21cn.com
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 this bug report at http://bugs.php.net/?id=14736&edit=1