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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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: Thu Dec 26 14:01:30 2024 UTC