php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #13280 suggestions about variables scope, warnning
Submitted: 2001-09-13 03:43 UTC Modified: 2010-12-17 13:10 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: Xuefer at 21cn dot com Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 4.0.6 OS: any
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
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-09-13 03:43 UTC] Xuefer at 21cn dot com
suggestions
1. any variables start with $_ and $PHP_ and also $HTTP_
should be always global
no need to use such as
   global $PHP_SELF;

if possible, set_global_all(true); makes variables scope just like c/java do

2. if we access $PHP_POST_VARS['...'] and it's not set
should trigger an special warnning, not a normal warnning
cause it's not that variables we can initize
so that, we can easily turn off the special warnning without ignoring the other normal warnning.

3. we don't like
  $a = 0;
to initize an variable, we like
  int $a; // it's auto initized into 0
or
  int $a=1234;

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-17 13:10 UTC] jani@php.net
-Status: Open +Status: Bogus -Package: Feature/Change Request +Package: *General Issues
 [2010-12-17 13:10 UTC] jani@php.net
We have superglobals nowadays.. no idea what else you need. Utterly super globals also are suggested in other FRs. Closing this..
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 11:01:30 2024 UTC