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

From: Date: Sun, 24 Feb 2002 16:46:01 +0000
Subject: Bug #15696 Updated: Can't set/unset global-ed variables
References: 1  Groups: php.bugs php.doc 
Request: Send a blank email to php-bugs+get-959@lists.php.net to get a copy of this message
 ID:               15696
 Updated by:       mfischer@php.net
-Summary:          Can't set/unset global-ed variables
 Reported By:      marekm@aptus.pl
-Status:           Bogus
+Status:           Open
-Bug Type:         Scripting Engine problem
+Bug Type:         Documentation problem
 Operating System: Linux & Win32
 PHP Version:      4.1.1
 New Comment:

Re-Opening as documentation problem.


Previous Comments:
------------------------------------------------------------------------

[2002-02-24 10:52:26] marekm@aptus.pl

OK, I know that.
I was just moving an old PHP3 script to PHP4 and noticed that problem.
Anyway, there's nothing mentioned in "Migrating from PHP 3.0 to PHP
4.0" section of the manual about this (significant I think) change. 

Thanks for the reply,

Marek Matula

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

[2002-02-24 10:27:28] yohgaki@php.net

Read manual about reference. You are unsetting reference to global. Not
the actual var.

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

[2002-02-24 10:12:53] derick@php.net

The bug system is not the appropriate forum for asking support
questions. For a list of a range of more appropriate places to ask
for help using PHP, please visit http://www.php.net/support.php

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

[2002-02-24 10:10:51] marekm@aptus.pl

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 this bug report at http://bugs.php.net/?id=15696&edit=1



Thread (6 messages)

« previous php.bugs (#959) next »