Download src/php/php-src/Zend/tests/generators/bug71980.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 574 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/generators/bug71980.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/Zend/tests/generators/bug71980.phpt
-
curl -L -o bug71980.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/generators/bug71980.phpt
574 Bytes
| --TEST-- | |
| Bug #71980: Decorated/Nested Generator is Uncloseable in Finally | |
| --FILE-- | |
| class Dtor { | |
| public function __destruct() { | |
| echo "Dtor\n"; | |
| } | |
| } | |
| function gen1() { | |
| try { | |
| foreach ([42, new Dtor] as $value) { | |
| yield $value; | |
| } | |
| } finally { | |
| echo "Finally\n"; | |
| } | |
| } | |
| function gen2() { | |
| try { | |
| var_dump(new Dtor, yield); | |
| } finally { | |
| echo "Finally\n"; | |
| } | |
| } | |
| $gen = gen1(); | |
| $gen->rewind(); | |
| unset($gen); | |
| $gen = gen2(); | |
| $gen->rewind(); | |
| unset($gen); | |
| --EXPECT-- | |
| Dtor | |
| Finally | |
| Dtor | |
| Finally | |