Bug #20175 (Static vars can't store ref to new instance)
| From: | Moriyoshi Koizumi | Date: | Wed, 30 Oct 2002 20:51:54 +0000 |
| Subject: | Bug #20175 (Static vars can't store ref to new instance) | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-90338@lists.php.net to get a copy of this message | ||
I've simplified the test code, and I still have got a strange result
with ZE2.
------------------------------------------------------
<?php
function foo() {
static $value;
if (!isset($value)) {
$value = rand(0,100);
}
return $value;
}
function bar() {
static $value;
if (!isset($value)) {
$value = &rand(0,100);
}
return $value;
}
print zend_version()."\n";
print foo()."\n";
print foo()."\n";
print bar()."\n";
print bar()."\n";
?>
------------------------------------------------------
with ZE1
------------------------------------------------------
1.3.0
26
26
75
95
------------------------------------------------------
with ZE2
------------------------------------------------------
2.0.0-alpha3
34
34
29
92
------------------------------------------------------
Is this a known behaviour?
Moriyoshi