com php-src: Fixed incorrect constant propagation: ext/opcache/ Optimizer/zend_optimizer.c ext/opcache/tests/wrong_inli ning_001.phpt

From: Date: Thu, 30 Jun 2016 17:48:16 +0000
Subject: com php-src: Fixed incorrect constant propagation: ext/opcache/ Optimizer/zend_optimizer.c ext/opcache/tests/wrong_inli ning_001.phpt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-92720@lists.php.net to get a copy of this message
Commit: 5ae07dc34ac7582c6ea5fdc5f24129a05ac9c78a Author: Dmitry Stogov <dmitry@zend.com> Thu, 30 Jun 2016 20:48:16 +0300 Parents: 6f8273e3bf883fe43d995683fbf1c0b2e99cfa25 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=5ae07dc34ac7582c6ea5fdc5f24129a05ac9c78a Log: Fixed incorrect constant propagation Changed paths: M ext/opcache/Optimizer/zend_optimizer.c A ext/opcache/tests/wrong_inlining_001.phpt Diff: diff --git a/ext/opcache/Optimizer/zend_optimizer.c b/ext/opcache/Optimizer/zend_optimizer.c index 43b355e..f1c62dd 100644 --- a/ext/opcache/Optimizer/zend_optimizer.c +++ b/ext/opcache/Optimizer/zend_optimizer.c @@ -195,12 +195,9 @@ int zend_optimizer_update_op1_const(zend_op_array *op_array, opline->opcode = ZEND_SEND_VAL; opline->op1.constant = zend_optimizer_add_literal(op_array, val); break; - case ZEND_SEND_VAR_NO_REF_EX: - opline->opcode = ZEND_SEND_VAL_EX; - opline->op1.constant = zend_optimizer_add_literal(op_array, val); - break; case ZEND_SEPARATE: case ZEND_SEND_VAR_NO_REF: + case ZEND_SEND_VAR_NO_REF_EX: zval_ptr_dtor(val); return 0; case ZEND_CONCAT: diff --git a/ext/opcache/tests/wrong_inlining_001.phpt b/ext/opcache/tests/wrong_inlining_001.phpt new file mode 100644 index 0000000..5cc515c --- /dev/null +++ b/ext/opcache/tests/wrong_inlining_001.phpt @@ -0,0 +1,28 @@ +--TEST-- +Pass result of inlined function by reference +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +--SKIPIF-- +<?php require_once('skipif.inc'); ?> +--FILE-- +<?php +function get_const() { + return 42; +} + +function test() { + foo(get_const()); +} + +if (true) { + function foo(&$ref) {} +} + +test(); +?> +OK +--EXPECTF-- +Notice: Only variables should be passed by reference in %swrong_inlining_001.php on line 7 +OK \ No newline at end of file

« previous php.cvs (#92720) next »