Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 7a954ac

Browse files
committed
Do not mark multiplication op as commutative
As it might not be when an internal object overloads the multiplication operation
1 parent 41c3873 commit 7a954ac

File tree

5 files changed

+67
-15
lines changed

5 files changed

+67
-15
lines changed

‎Zend/zend_vm_def.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ ZEND_VM_HELPER(zend_mul_helper, ANY, ANY, zval *op_1, zval *op_2)
162162
ZEND_VM_NEXT_OPCODE_CHECK_EXCEPTION();
163163
}
164164

165-
ZEND_VM_COLD_CONSTCONST_HANDLER(3, ZEND_MUL, CONST|TMPVARCV, CONST|TMPVARCV, SPEC(COMMUTATIVE))
165+
ZEND_VM_COLD_CONSTCONST_HANDLER(3, ZEND_MUL, CONST|TMPVARCV, CONST|TMPVARCV)
166166
{
167167
USE_OPLINE
168168
zval *op1, *op2, *result;
@@ -7591,7 +7591,7 @@ ZEND_VM_HOT_NOCONST_HANDLER(198, ZEND_JMP_NULL, CONST|TMP|VAR|CV, JMP_ADDR)
75917591
uint32_t short_circuiting_type = opline->extended_value & ZEND_SHORT_CIRCUITING_CHAIN_MASK;
75927592
if (EXPECTED(short_circuiting_type == ZEND_SHORT_CIRCUITING_CHAIN_EXPR)) {
75937593
ZVAL_NULL(result);
7594-
if (OP1_TYPE == IS_CV
7594+
if (OP1_TYPE == IS_CV
75957595
&& UNEXPECTED(Z_TYPE_P(val) == IS_UNDEF)
75967596
&& (opline->extended_value & ZEND_JMP_NULL_BP_VAR_IS) == 0
75977597
) {

‎Zend/zend_vm_execute.h‎

Lines changed: 61 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎Zend/zend_vm_handlers.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
_(48, ZEND_SUB_SPEC_TMPVARCV_TMPVARCV) \
3434
_(50, ZEND_SUB_SPEC_TMPVARCV_TMPVARCV) \
3535
_(51, ZEND_MUL_SPEC_CONST_CONST) \
36+
_(52, ZEND_MUL_SPEC_CONST_TMPVARCV) \
37+
_(53, ZEND_MUL_SPEC_CONST_TMPVARCV) \
38+
_(55, ZEND_MUL_SPEC_CONST_TMPVARCV) \
3639
_(56, ZEND_MUL_SPEC_TMPVARCV_CONST) \
3740
_(57, ZEND_MUL_SPEC_TMPVARCV_TMPVARCV) \
3841
_(58, ZEND_MUL_SPEC_TMPVARCV_TMPVARCV) \

‎Zend/zend_vm_opcodes.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ static uint32_t zend_vm_opcodes_flags[203] = {
232232
0x00000000,
233233
0x00000b0b,
234234
0x00000b0b,
235-
0x80000b0b,
235+
0x00000b0b,
236236
0x00000707,
237237
0x00000b0b,
238238
0x00000b0b,

‎ext/zend_test/tests/zend_non_commutative_test.phpt‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
Zend: test non commutative multiplication object handler
33
--EXTENSIONS--
44
zend_test
5-
--XFAIL--
6-
Broken non commutative multiplication with more than 2 ops
75
--FILE--
86
<?php
97

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /