Skip to content

Commit d7483f8

Browse files
committed
Fixed the processing when op1 and ret are the same in do_operation.
1 parent a550e14 commit d7483f8

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

ext/bcmath/bcmath.c

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1198,13 +1198,6 @@ static zend_result bcmath_number_do_operation(uint8_t opcode, zval *ret_val, zva
11981198
goto fail;
11991199
}
12001200

1201-
/* For increment and decrement, etc */
1202-
zval op1_copy;
1203-
if (ret_val == op1) {
1204-
ZVAL_COPY_VALUE(&op1_copy, op1);
1205-
op1 = &op1_copy;
1206-
}
1207-
12081201
bc_num ret = NULL;
12091202
size_t scale;
12101203
switch (opcode) {
@@ -1248,9 +1241,10 @@ static zend_result bcmath_number_do_operation(uint8_t opcode, zval *ret_val, zva
12481241
ZVAL_OBJ(ret_val, &intern->std);
12491242

12501243
/* For increment and decrement, etc */
1251-
if (op1 == &op1_copy) {
1252-
zval_ptr_dtor(op1);
1244+
if (ret_val == op1) {
1245+
zval_ptr_dtor(ret_val);
12531246
}
1247+
ZVAL_OBJ(ret_val, &intern->std);
12541248

12551249
return SUCCESS;
12561250

0 commit comments

Comments
 (0)