Bug #13967: unset() on a static variable causes it to forget it is static

From: Date: Wed, 07 Nov 2001 02:49:10 +0000
Subject: Bug #13967: unset() on a static variable causes it to forget it is static
Groups: php.dev 
Request: Send a blank email to php-dev+get-69734@lists.php.net to get a copy of this message
From:             david@php.net
Operating system: Debian Linux
PHP version:      4.0.6
PHP Bug Type:     Scripting Engine problem
Bug description:  unset() on a static variable causes it to forget it is static

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



Thread (3 messages)

« previous php.dev (#69734) next »