ID: 8972
Updated by: stas
Old-Status: Open
Status: Closed
Bug Type: Scripting Engine problem
Assigned To: 

No, it won't work that way (your first example). Unset
breaks the reference. Please read the "References explained"
part in the manual.

Previous Comments:

[2001-01-28 19:40:52] [EMAIL PROTECTED]
I found another bug (see id #8937) in connection with unset(). [Unset dosnīt work 
properly since august 1999]


function test(&$bla) {



echo $bla;


This will return "HIHI" instead of an expected "" or "huhu".

This bug exists cause unset() unsets the reference to $bla, not $bla itself. This also 
depends the GLOBAL-statement (see #8937)!

This is a bug, cause it is against the PHP-concept of making no big difference between 
reference and value
[ $bla=1; $hugo=&$bla; $hugo=2 is in the sight of $bla the same as $bla=1; $bla=2; ]

If I want to delete &$bla the correct expression is unset(&$bla). unset($bla) has 
always to delete the value
and all references to it. (that's just my opinion :-)

A fix of this bug will produce some compatibility problems with scripts, which has 
been written into PHP4 (cause the bug is very old).
But a fix should be done, cause many developers won't mind, that unseting a reference 
is in the sight of PHP a completly other thing than unseting a value.
There should be no/very less problems with upgrading PHP3-scripts.

PS: Just a small thought. In autumn last year I programmed constructs like the 
And I wondered, that this won't work as expected. Now I know why.
A correct solution would be to unset the inner array(1,2,3) and $ref... any other 
behaviour will break the mentioned handling of PHP.

Thougth 2:
What is the correct value of $bla. "" (empty) or "huhu"?


ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at

PHP Development Mailing List <>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to