?? Jan 2016 PHP 7.0.2
- Core:
+ . Fixed bug #71092 (Segmentation fault with return type hinting). (Laruence)
. Fixed bug memleak in header_register_callback. (Laruence)
. Fixed bug #71067 (Local object in class method stays in memory for each
call). (Laruence)
--- /dev/null
+--TEST--
+return type with finally
+--INI--
+opcache.enable=0
+--FILE--
+<?php
+
+function foo() : array {
+ try {
+ throw new Exception("xxxx");
+ } finally {
+ return ;
+ }
+}
+
+foo();
+?>
+--EXPECTF--
+Fatal error: Uncaught TypeError: Return value of foo() must be of the type array, none returned in %s29.php:%d
+Stack trace:
+#0 %s(%d): foo()
+#1 {main}
+ thrown in %s029.php on line %d
--- /dev/null
+--TEST--
+Bug #71092 (Segmentation fault with return type hinting)
+--INI--
+opcache.enable=0
+--FILE--
+<?php
+
+function boom(): array {
+ $data = [['id']];
+ switch ($data[0]) {
+ case ['id']:
+ return;
+ }
+}
+
+boom();
+?>
+--EXPECTF--
+Fatal error: Uncaught TypeError: Return value of boom() must be of the type array, none returned in %sbug71092.php:%d
+Stack trace:
+#0 %s(%d): boom()
+#1 {main}
+ thrown in %sbug71092.php on line %d
zend_compile_expr(&expr_node, expr_ast);
}
- zend_handle_loops_and_finally();
-
if (CG(context).in_finally) {
opline = zend_emit_op(NULL, ZEND_DISCARD_EXCEPTION, NULL, NULL);
opline->op1_type = IS_TMP_VAR;
if (!(CG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR) && CG(active_op_array)->fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
zend_emit_return_type_check(expr_ast ? &expr_node : NULL, CG(active_op_array)->arg_info - 1);
}
+
+ zend_handle_loops_and_finally();
+
opline = zend_emit_op(NULL, by_ref ? ZEND_RETURN_BY_REF : ZEND_RETURN,
&expr_node, NULL);