php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #31739 can't unset global variables.
Submitted: 2005-01-28 09:47 UTC Modified: 2005-01-28 09:54 UTC
From: diag at cheerful dot com Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: Irrelevant OS:
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: diag at cheerful dot com
New email:
PHP Version: OS:

 

 [2005-01-28 09:47 UTC] diag at cheerful dot com
Description:
------------
The bug report engine of this site lets you happily type in comments on closed bugs, and tells you only later you cannot comment on closed bugs. This is annoying.

And not being able to unset globals inside a function the simple way IS a bug to me, not "bogus". This will bite someone in the ass security-wise. If you really think globals should be not be unset inside a function, just the reference, you might just as well ditch the "globals $.. " directive, and force people to use $localvar= $GLOBALS['var']; or $localvar= &$GLOBALS['var']; instead, at least people will then understand what they are doing.

Reproduce code:
---------------
function login(){
  global $loggedin;
  unset($loggedin);//gives unexpected result
...
}


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-28 09:54 UTC] derick@php.net
You can unset it with unset($GLOBALS['variable']). Obviously we're not going to change this as it breaks a damn lot of scripts.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 29 08:01:32 2024 UTC