com php-src: Add test guaranteeing that loop vars are only freed after potential return type exceptions: Zend/tests/return_types/0 29.phpt

From: Date: Thu, 09 Jul 2015 14:54:41 +0000
Subject: com php-src: Add test guaranteeing that loop vars are only freed after potential return type exceptions: Zend/tests/return_types/0 29.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-87863@lists.php.net to get a copy of this message
Commit: f5db5a558d550bf441373febebbb02f3884209d1 Author: Bob Weinand <bobwei9@hotmail.com> Thu, 9 Jul 2015 16:54:41 +0200 Parents: 54f367ee2a2e4cb7c952b17915c226fdc56038ab Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=f5db5a558d550bf441373febebbb02f3884209d1 Log: Add test guaranteeing that loop vars are only freed after potential return type exceptions Changed paths: A Zend/tests/return_types/029.phpt Diff: diff --git a/Zend/tests/return_types/029.phpt b/Zend/tests/return_types/029.phpt new file mode 100644 index 0000000..3758745 --- /dev/null +++ b/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

« previous php.cvs (#87863) next »