From:             david at tulloh dot id dot au
Operating system: 
PHP version:      Irrelevant
PHP Bug Type:     Documentation problem
Bug description:  static unset documentation is unclear

Description:
------------
http://www.php.net/manual/en/function.unset.php#AEN183845

The documentation for unsetting static variables is very unclear and
confusing due to it's contradictory nature.

It is stated that the variable is destroyed, yet the example shows that
this clearly isn't the case.  Rather the variable is only temporarily
destroyed, for the remainder of that function.

The example provided seems to demonstrate that unset has no effect,
removing the unset command produces exactly the same output.

I believe changing the descriptive text and changing the example to
something like the one below would make the behaviour far clearer.

Reproduce code:
---------------
<?php
function foo() {
    static $bar;
    $bar++;
    echo "Before unset: $bar\n";
    unset($bar);
    $bar = 23;
    echo "After unset: $bar\n";
}
foo();
foo();
foo();
?>

Before unset: 1
After unset: 23
Before unset: 2
After unset: 23
Before unset: 3
After unset: 23



-- 
Edit bug report at http://bugs.php.net/?id=34865&edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=34865&r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=34865&r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=34865&r=trysnapshot51
Fixed in CVS:                http://bugs.php.net/fix.php?id=34865&r=fixedcvs
Fixed in release:            http://bugs.php.net/fix.php?id=34865&r=alreadyfixed
Need backtrace:              http://bugs.php.net/fix.php?id=34865&r=needtrace
Need Reproduce Script:       http://bugs.php.net/fix.php?id=34865&r=needscript
Try newer version:           http://bugs.php.net/fix.php?id=34865&r=oldversion
Not developer issue:         http://bugs.php.net/fix.php?id=34865&r=support
Expected behavior:           http://bugs.php.net/fix.php?id=34865&r=notwrong
Not enough info:             
http://bugs.php.net/fix.php?id=34865&r=notenoughinfo
Submitted twice:             
http://bugs.php.net/fix.php?id=34865&r=submittedtwice
register_globals:            http://bugs.php.net/fix.php?id=34865&r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=34865&r=php3
Daylight Savings:            http://bugs.php.net/fix.php?id=34865&r=dst
IIS Stability:               http://bugs.php.net/fix.php?id=34865&r=isapi
Install GNU Sed:             http://bugs.php.net/fix.php?id=34865&r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=34865&r=float
No Zend Extensions:          http://bugs.php.net/fix.php?id=34865&r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=34865&r=mysqlcfg

Reply via email to