php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #20534 unset fails under certain conditions
Submitted: 2002-11-20 23:54 UTC Modified: 2002-11-21 00:42 UTC
From: sputnik at reflexx dot net Assigned:
Status: Not a bug Package: Variables related
PHP Version: 4.2.3 OS: FreeBSD 4.6
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: sputnik at reflexx dot net
New email:
PHP Version: OS:

 

 [2002-11-20 23:54 UTC] sputnik at reflexx dot net
global $myvar;
unset ($myvar);

// works.

-------------------

// ($unsetvar was set to "foo" somewhere in the script, and is global

global $unsetvar;
echo $unsetvar; // => "foo"

if($unsetvar == "foo") {
	echo "unsetting myvar";
	global $myvar;
	unset($myvar);
}

// this will echo "unsetting myvar" but NOT unset the variable!

// it seems the bug occurs when trying to use unset inside a structure that is doing some kind of test on a variable brought into global scope (even though the variable has the orrect value and the if statement succeeds!). It's not the if statement, because if(1) works.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-11-21 00:42 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 15:01:29 2024 UTC