php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #14736 about error_reporting for $_GET
Submitted: 2001-12-28 10:58 UTC Modified: 2002-12-04 11:34 UTC
From: Xuefer at 21cn dot com Assigned:
Status: Wont fix Package: Feature/Change Request
PHP Version: 4.1.1 OS: all
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: Xuefer at 21cn dot com
New email:
PHP Version: OS:

 

 [2001-12-28 10:58 UTC] Xuefer at 21cn dot 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']

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-12-04 11:34 UTC] philip@php.net
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().


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Mar 19 10:01:30 2024 UTC