diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-04-01 10:25:22 +0200 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-05-05 16:11:13 +0200 |
commit | 5bc1e224dbd660cea99c222baf8bd3c215d25073 (patch) | |
tree | 00414aab9d3884198debc4497df632c74b6984a7 /Zend/zend_compile.c | |
parent | 31fb6a08b3a02e665d0e24d2cbd56d13342423c8 (diff) | |
download | php-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.c | 8 |
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, |