1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 08:12:21 +01:00

Merge branch 'PHP-7.0'

This commit is contained in:
Nikita Popov
2016-02-12 17:58:12 +01:00
2 changed files with 17 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
--TEST--
Yield from by reference is not supported
--FILE--
<?php
function &gen() {
yield from [];
}
?>
--EXPECTF--
Fatal error: Cannot use "yield from" inside a by-reference generator in %s on line %d

View File

@@ -6616,6 +6616,11 @@ void zend_compile_yield_from(znode *result, zend_ast *ast) /* {{{ */
zend_mark_function_as_generator();
if (CG(active_op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) {
zend_error_noreturn(E_COMPILE_ERROR,
"Cannot use \"yield from\" inside a by-reference generator");
}
zend_compile_expr(&expr_node, expr_ast);
zend_emit_op_tmp(result, ZEND_YIELD_FROM, &expr_node, NULL);
}