Browse Source

Add test guaranteeing that loop vars are only freed after potential return type exceptions

pull/1402/head
Bob Weinand 11 years ago
parent
commit
f5db5a558d
  1. 19
      Zend/tests/return_types/029.phpt

19
Zend/tests/return_types/029.phpt

@ -0,0 +1,19 @@
--TEST--
Return types must not double free loop variables
--FILE--
<?php
function foo(): string {
foreach ([new stdClass] as $class) {
try {
return $class; // invalid return type
} catch (TypeError $e) {
return "no leak or segfault";
}
}
}
print foo();
?>
--EXPECT--
no leak or segfault
Loading…
Cancel
Save