diff options
| author | Nikita Popov <nikita.ppv@gmail.com> | 2017-04-15 12:36:02 +0200 |
|---|---|---|
| committer | Nikita Popov <nikita.ppv@gmail.com> | 2017-04-15 12:36:02 +0200 |
| commit | 7cd7305b1be87de3981018479ce5bc61f82e8c92 (patch) | |
| tree | db636711f2d54ef524438d1754c654c146a053d6 | |
| parent | 0c3bc432071e6a564491f3d38acf2d7450700162 (diff) | |
| parent | 00c6ce0e00c26288183360b58974cc4bacdbe6d1 (diff) | |
| download | php-git-7cd7305b1be87de3981018479ce5bc61f82e8c92.tar.gz | |
Merge branch 'PHP-7.1'
| -rw-r--r-- | ext/opcache/Optimizer/compact_literals.c | 3 | ||||
| -rw-r--r-- | ext/opcache/tests/method_call_on_literal.phpt | 14 |
2 files changed, 17 insertions, 0 deletions
diff --git a/ext/opcache/Optimizer/compact_literals.c b/ext/opcache/Optimizer/compact_literals.c index e557f02a11..90eab75e5a 100644 --- a/ext/opcache/Optimizer/compact_literals.c +++ b/ext/opcache/Optimizer/compact_literals.c @@ -147,6 +147,9 @@ void zend_optimizer_compact_literals(zend_op_array *op_array, zend_optimizer_ctx LITERAL_INFO(opline->op2.constant, LITERAL_FUNC, 1, 1, 3); break; case ZEND_INIT_METHOD_CALL: + if (ZEND_OP1_TYPE(opline) == IS_CONST) { + LITERAL_INFO(opline->op1.constant, LITERAL_VALUE, 1, 0, 1); + } if (ZEND_OP2_TYPE(opline) == IS_CONST) { optimizer_literal_obj_info( info, diff --git a/ext/opcache/tests/method_call_on_literal.phpt b/ext/opcache/tests/method_call_on_literal.phpt new file mode 100644 index 0000000000..bf89caa418 --- /dev/null +++ b/ext/opcache/tests/method_call_on_literal.phpt @@ -0,0 +1,14 @@ +--TEST-- +Literal compaction should take method calls on literals into account +--FILE-- +<?php + +try { + (42)->foo(); +} catch (Error $e) { + echo $e->getMessage(), "\n"; +} + +?> +--EXPECT-- +Call to a member function foo() on integer |
