Download src/php/php-src/Zend/tests/generators/bug71441.phpt from meddyrat/dis-bench: direct link, hf CLI and curl.
- Browser
- Download file 501 Bytes
-
https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/generators/bug71441.phpt
- Command line
-
hf download hf://datasets/meddyrat/dis-bench/src/php/php-src/Zend/tests/generators/bug71441.phpt
-
curl -L -o bug71441.phpt https://huggingface.co/datasets/meddyrat/dis-bench/resolve/main/src/php/php-src/Zend/tests/generators/bug71441.phpt
501 Bytes
| --TEST-- | |
| Bug #71441 (Typehinted Generator with return in try/finally crashes) | |
| --FILE-- | |
| $num = 2000; /* to be sure to be in wild memory */ | |
| $add = str_repeat("1 +", $num); | |
| $gen = (eval(<<<PHP | |
| return function (): \Generator { | |
| try { | |
| \$a = 1; | |
| \$foo = \$a + $add \$a; | |
| return yield \$foo; | |
| } finally { | |
| print "Ok\n"; | |
| } | |
| }; | |
| PHP | |
| ))(); | |
| var_dump($gen->current()); | |
| $gen->send("Success"); | |
| var_dump($gen->getReturn()); | |
| --EXPECT-- | |
| int(2002) | |
| Ok | |
| string(7) "Success" | |