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
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-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: Fri Dec 27 00:01:30 2024 UTC