xref: /PHP-8.2/Zend/tests/generators/bug71441.phpt (revision f8d79582)
1--TEST--
2Bug #71441 (Typehinted Generator with return in try/finally crashes)
3--FILE--
4<?php
5
6$num = 2000; /* to be sure to be in wild memory */
7$add = str_repeat("1 +", $num);
8$gen = (eval(<<<PHP
9return function (): \Generator {
10    try {
11        \$a = 1;
12        \$foo = \$a + $add \$a;
13        return yield \$foo;
14    } finally {
15        print "Ok\n";
16    }
17};
18PHP
19))();
20var_dump($gen->current());
21$gen->send("Success");
22var_dump($gen->getReturn());
23
24?>
25--EXPECT--
26int(2002)
27Ok
28string(7) "Success"
29