summaryrefslogtreecommitdiff
path: root/Zend/zend_compile.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-04-01 10:25:22 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-05-05 16:11:13 +0200
commit5bc1e224dbd660cea99c222baf8bd3c215d25073 (patch)
tree00414aab9d3884198debc4497df632c74b6984a7 /Zend/zend_compile.c
parent31fb6a08b3a02e665d0e24d2cbd56d13342423c8 (diff)
downloadphp-git-5bc1e224dbd660cea99c222baf8bd3c215d25073.tar.gz
Make numeric operations on resources, arrays and objects type errors
RFC: https://wiki.php.net/rfc/arithmetic_operator_type_checks Closes GH-5331.
Diffstat (limited to 'Zend/zend_compile.c')
-rw-r--r--Zend/zend_compile.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index bc214fa39a..8e620b2779 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -7219,11 +7219,9 @@ ZEND_API zend_bool zend_binary_op_produces_error(uint32_t opcode, zval *op1, zva
/* Adding two arrays is allowed. */
return 0;
}
- if (opcode == ZEND_ADD || opcode == ZEND_SUB || opcode == ZEND_MUL || opcode == ZEND_POW
- || opcode == ZEND_DIV) {
- /* These operators throw when one of the operands is an array. */
- return 1;
- }
+
+ /* Numeric operators throw when one of the operands is an array. */
+ return 1;
}
/* While basic arithmetic operators always produce numeric string errors,