ID: 13967
Updated by: jan
Reported By: [EMAIL PROTECTED]
Old Status: Open
Status: Closed
Bug Type: Documentation problem
Operating System: Debian Linux
PHP Version: 4.0.6
New Comment:

fixed in CVS

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

[2001-11-07 18:29:43] [EMAIL PROTECTED]

Like with global, static is a keyword linking a variable specially. unset() will 
completely destroy the variable with all links it might have. This is expected 
behaviour, or at least a known side-effect. With the current way of handling variables 
internally, this is not going to change.

This isn't stressen enough in the manual, so changing to documentation problem.

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

[2001-11-06 21:49:10] [EMAIL PROTECTED]

Doing unset() on a static variable causes it to forget the fact that it is static for 
the rest of the function.

e.g.

<?
function abc() {
  static $a = 123;
  echo "On entry, a = $a\n";
  unset($a);
  $a = 456;
}

abc();
abc();
?>

should give 123 then 456. It gives 123 and 123.

Replacing unset($a) with $a = null, or removing the unset() entirely has the desired 
result of giving 123 then 456.

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



Edit this bug report at http://bugs.php.net/?id=13967&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
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