php-src/Zend/tests/bug54367.phpt
Máté Kocsis 75a678a7e3
Declare tentative return types for Zend (#7251)
Co-authored-by: Nikita Popov <nikita.ppv@gmail.com>
2021-07-19 13:44:20 +02:00

25 lines
545 B
PHP

--TEST--
Bug #54367 (Use of closure causes problem in ArrayAccess)
--FILE--
<?php
class MyObjet implements ArrayAccess
{
public function offsetSet($offset, $value): void { }
public function offsetExists($offset): bool { }
public function offsetUnset($offset): void { }
public function offsetGet($offset): mixed
{
return function ($var) use ($offset) { // here is the problem
var_dump($offset, $var);
};
}
}
$a = new MyObjet();
echo $a['p']('foo');
?>
--EXPECT--
string(1) "p"
string(3) "foo"