Fixed bug #70240 (Segfault when doing unset($var());)

This commit is contained in:
Xinchen Hui 2015-08-11 21:42:11 +08:00
parent 162bf9e802
commit 4064ee3061
3 changed files with 12 additions and 1 deletions

1
NEWS
View File

@ -3,6 +3,7 @@ PHP NEWS
20 Aug 2015, PHP 7.0.0 RC 1
- Core:
. Fixed bug #70240 (Segfault when doing unset($var());). (Laruence)
. Fixed bug #70223 (Incrementing value returned by magic getter). (Laruence)
. Fixed bug #70215 (Segfault when __invoke is static). (Bob)
. Fixed bug #70207 (Finally is broken with opcache). (Laruence, Dmitry)

8
Zend/tests/bug70240.phpt Normal file
View File

@ -0,0 +1,8 @@
--TEST--
Bug #70240 (Segfault when doing unset($var()))
--FILE--
<?php
unset($var());
?>
--EXPECTF--
Fatal error: Can't use function return value in write context in %sbug70240.php on line %d

View File

@ -3428,9 +3428,11 @@ void zend_compile_static_var(zend_ast *ast) /* {{{ */
void zend_compile_unset(zend_ast *ast) /* {{{ */
{
zend_ast *var_ast = ast->child[0];
znode var_node;
zend_op *opline;
zend_ensure_writable_variable(var_ast);
switch (var_ast->kind) {
case ZEND_AST_VAR:
if (zend_try_compile_cv(&var_node, var_ast) == SUCCESS) {