Download src/php/php-src/Zend/tests/closures/bug54367.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 547 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/closures/bug54367.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/Zend/tests/closures/bug54367.phpt
-
curl -L -o bug54367.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/closures/bug54367.phpt
547 Bytes
| --TEST-- | |
| Bug #54367 (Use of closure causes problem in ArrayAccess) | |
| --FILE-- | |
| class MyObject 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 MyObject(); | |
| echo $a['p']('foo'); | |
| --EXPECT-- | |
| string(1) "p" | |
| string(3) "foo" | |