1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00
Files
archived-php-src/Zend/tests/closures/bug79778.phpt
DanielEScherzer d22abca488 Zend/tests: organize some tests with sub directories (5) (#17800)
Second pass through `Zend/tests/bug*` to organize the tests.

Move tests to existing sub directories, and create some new sub directories:
* `ArrayAccess`
* `autoload`
* `clone`
* `serialize` (also covers `unserialize()`)
* `switch`

Work towards GH-15631
2025-02-14 11:49:14 +00:00

101 lines
1.4 KiB
PHP

--TEST--
Bug #79778: Assertion failure if dumping closure with unresolved static variable
--FILE--
<?php
$closure1 = function() {
static $var = CONST_REF;
};
var_dump($closure1);
print_r($closure1);
try {
$closure1();
} catch (\Error $e) {
echo $e->getMessage(), "\n";
}
var_dump($closure1);
print_r($closure1);
const CONST_REF = 'foo';
$closure1();
var_dump($closure1);
print_r($closure1);
?>
--EXPECTF--
object(Closure)#%d (4) {
["name"]=>
string(%d) "{closure:%s:%d}"
["file"]=>
string(%d) "%s"
["line"]=>
int(%d)
["static"]=>
array(1) {
["var"]=>
NULL
}
}
Closure Object
(
[name] => {closure:%s:%d}
[file] => %s
[line] => %d
[static] => Array
(
[var] =>
)
)
Undefined constant "CONST_REF"
object(Closure)#%d (4) {
["name"]=>
string(%d) "{closure:%s:%d}"
["file"]=>
string(%d) "%s"
["line"]=>
int(%d)
["static"]=>
array(1) {
["var"]=>
NULL
}
}
Closure Object
(
[name] => {closure:%s:%d}
[file] => %s
[line] => %d
[static] => Array
(
[var] =>
)
)
object(Closure)#%d (4) {
["name"]=>
string(%d) "{closure:%s:%d}"
["file"]=>
string(%d) "%s"
["line"]=>
int(%d)
["static"]=>
array(1) {
["var"]=>
string(3) "foo"
}
}
Closure Object
(
[name] => {closure:%s:%d}
[file] => %s
[line] => %d
[static] => Array
(
[var] => foo
)
)