[PHP-DOC] #37047 [Bgs->Opn]: static executes after return
by Karoly At Negyesi Dot Net other posts by this author
Apr 11 2006 3:28PM messages near this date
[PHP-DOC] #37047 [Opn->Bgs]: static executes after return
|
[PHP-DOC] #37038 [NEW]: Problem with searching for '<<<' in online documentation
ID: 37047
User updated by: karoly at negyesi dot net
Reported By: karoly at negyesi dot net
-Status: Bogus
+Status: Open
-Bug Type: Scripting Engine problem
+Bug Type: Documentation problem
Operating System: Irrevelant
PHP Version: 5.1.2
New Comment:
Then this is a docs issue. Because I do not expect anything to be
executed after a return...
Previous Comments:
------------------------------------------------------------------------
[2006-04-11 22:21:31] tony2001@[...].net
Static variables are resolved in compile time.
Expected behaviour.
------------------------------------------------------------------------
[2006-04-11 22:15:50] karoly at negyesi dot net
Description:
------------
The code has been tested on PHP 4.3, 4.4, 5.0 and 5.1 various minors.
Reproduce code:
---------------
function storage($key) {
static $storage = array('a' => array('x', 'y'));
return $storage[$key];
static $storage = array('x', 'y'); // comment this out to see
expected result
}
var_dump(storage('a'));
Expected result:
----------------
array(2) {
[0]=>
string(1) "x"
[1]=>
string(1) "y"
}
Actual result:
--------------
NULL
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=37047&edit=1
|