Bug #15696: Can't set/unset global-ed variables

From: Date: Sun, 24 Feb 2002 15:10:52 +0000
Subject: Bug #15696: Can't set/unset global-ed variables
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-950@lists.php.net to get a copy of this message
From:             marekm@aptus.pl
Operating system: Linux & Win32
PHP version:      4.1.1
PHP Bug Type:     Scripting Engine problem
Bug description:  Can't set/unset global-ed variables

I'm running the following script:

$id=1;
function test()
{
	global $id;
	unset($id);
}
test();
echo($id);

As the function test is being executed I think, the $id variable should be
unset and so the script should output nothing, but it outputs 1. It IS
possible to change the value od $id inside the 'test' function, it's just
not possible to change the set/unset state. 
It's easy to omit the problem by unsetting $GLOBALS["id"] variable, but I
think it should be possible to unset the global-ed variable in both ways.
The problem affects all PHP 4.x versions. The 3.x versions work as I
expect.

Regards,
Marek Matula


-- 
Edit bug report at http://bugs.php.net/?id=15696&edit=1
-- 
Fixed in CVS:        http://bugs.php.net/fix.php?id=15696&r=fixedcvs
Fixed in release:    http://bugs.php.net/fix.php?id=15696&r=alreadyfixed
Need backtrace:      http://bugs.php.net/fix.php?id=15696&r=needtrace
Try newer version:   http://bugs.php.net/fix.php?id=15696&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=15696&r=support
Expected behavior:   http://bugs.php.net/fix.php?id=15696&r=notwrong
Not enough info:     http://bugs.php.net/fix.php?id=15696&r=notenoughinfo
Submitted twice:     http://bugs.php.net/fix.php?id=15696&r=submittedtwice



Thread (6 messages)

« previous php.bugs (#950) next »