mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00

This flag was never necessary. We know a static variable is uninitialized (i.e. the initializer has never been called) iff the zval in the static variable array does not contain a reference. Prompted by a related issue in ext-uopz reported by Christoph.
21 lines
340 B
PHP
21 lines
340 B
PHP
--TEST--
|
|
Static variable with throwing initializer
|
|
--FILE--
|
|
<?php
|
|
|
|
function foo($throw) {
|
|
static $a = $throw ? (throw new Exception('Throwing from foo()')) : 42;
|
|
return $a;
|
|
}
|
|
|
|
try {
|
|
var_dump(foo(true));
|
|
} catch (Exception $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
var_dump(foo(false));
|
|
|
|
?>
|
|
--EXPECT--
|
|
Throwing from foo()
|
|
int(42)
|