com php-src: Disabled usage of built-in functions in write context (e.g. strlen($s)[] = ...): Zend/zend_compile.c

From: Date: Wed, 03 Sep 2014 12:30:48 +0000
Subject: com php-src: Disabled usage of built-in functions in write context (e.g. strlen($s)[] = ...): Zend/zend_compile.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-81401@lists.php.net to get a copy of this message
Commit: c52511c30703d2921f813ccf1557bc042a7cd9d2 Author: Dmitry Stogov <dmitry@zend.com> Wed, 3 Sep 2014 16:30:48 +0400 Parents: 9a958a086d9718b8b88d742e0e836fef6d35adf2 Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c52511c30703d2921f813ccf1557bc042a7cd9d2 Log: Disabled usage of built-in functions in write context (e.g. strlen($s)[] = ...) Changed paths: M Zend/zend_compile.c Diff: diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c index a8ee529..0b42f95 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"); + } } } /* }}} */

« previous php.cvs (#81401) next »