forked from php/php-src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed bug #71441 (Typehinted Generator with return in try/finally cra…
…shes)
- Loading branch information
Showing
3 changed files
with
38 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--TEST-- | ||
Bug #71441 (Typehinted Generator with return in try/finally crashes) | ||
--FILE-- | ||
<?php | ||
|
||
$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" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters