diff options
author | Dmitry Stogov <dmitry@zend.com> | 2014-09-03 16:30:48 +0400 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2014-09-03 16:30:48 +0400 |
commit | c52511c30703d2921f813ccf1557bc042a7cd9d2 (patch) | |
tree | ffba8b312e82b407d1f6ed0c921c564014266d9a /Zend/zend_compile.c | |
parent | 9a958a086d9718b8b88d742e0e836fef6d35adf2 (diff) | |
download | php-git-c52511c30703d2921f813ccf1557bc042a7cd9d2.tar.gz |
Disabled usage of built-in functions in write context (e.g. strlen($s)[] = ...)
Diffstat (limited to 'Zend/zend_compile.c')
-rw-r--r-- | Zend/zend_compile.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index a8ee529a80..0b42f9597b 100644 --- a/Zend/zend_compile.c +++ b/Zend/zend_compile.c @@ -3604,9 +3604,13 @@ static void zend_compile_simple_var(znode *result, zend_ast *ast, uint32_t type static void zend_separate_if_call_and_write(znode *node, zend_ast *ast, uint32_t type TSRMLS_DC) /* {{{ */ { if (type != BP_VAR_R && type != BP_VAR_IS && zend_is_call(ast)) { - zend_op *opline = zend_emit_op(NULL, ZEND_SEPARATE, node, NULL TSRMLS_CC); - opline->result_type = IS_VAR; - opline->result.var = opline->op1.var; + if (node->op_type == IS_VAR) { + zend_op *opline = zend_emit_op(NULL, ZEND_SEPARATE, node, NULL TSRMLS_CC); + opline->result_type = IS_VAR; + opline->result.var = opline->op1.var; + } else { + zend_error_noreturn(E_COMPILE_ERROR, "Cannot use result of built-in function in write context"); + } } } /* }}} */ |