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
 [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

Add a Patch

Pull Requests

Add a Pull Request

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 Apr 25 05:01:33 2024 UTC