mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Fixed memory leak introduced by 73458e8f
This commit is contained in:
parent
0ea0b591d7
commit
8c99b65c4d
5 changed files with 118 additions and 0 deletions
25
Zend/tests/self_and.phpt
Normal file
25
Zend/tests/self_and.phpt
Normal file
|
@ -0,0 +1,25 @@
|
|||
--TEST--
|
||||
ANDing strings
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$s = "123";
|
||||
$s1 = "test";
|
||||
$s2 = "45345some";
|
||||
|
||||
$s &= 22;
|
||||
var_dump($s);
|
||||
|
||||
$s1 &= 11;
|
||||
var_dump($s1);
|
||||
|
||||
$s2 &= 33;
|
||||
var_dump($s2);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(18)
|
||||
int(0)
|
||||
int(33)
|
||||
Done
|
25
Zend/tests/self_mod.phpt
Normal file
25
Zend/tests/self_mod.phpt
Normal file
|
@ -0,0 +1,25 @@
|
|||
--TEST--
|
||||
Moduloing strings
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$s = "123";
|
||||
$s1 = "test";
|
||||
$s2 = "45345some";
|
||||
|
||||
$s %= 22;
|
||||
var_dump($s);
|
||||
|
||||
$s1 %= 11;
|
||||
var_dump($s1);
|
||||
|
||||
$s2 %= 33;
|
||||
var_dump($s2);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(13)
|
||||
int(0)
|
||||
int(3)
|
||||
Done
|
25
Zend/tests/self_or.phpt
Normal file
25
Zend/tests/self_or.phpt
Normal file
|
@ -0,0 +1,25 @@
|
|||
--TEST--
|
||||
ORing strings
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$s = "123";
|
||||
$s1 = "test";
|
||||
$s2 = "45345some";
|
||||
|
||||
$s |= 22;
|
||||
var_dump($s);
|
||||
|
||||
$s1 |= 11;
|
||||
var_dump($s1);
|
||||
|
||||
$s2 |= 33;
|
||||
var_dump($s2);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(127)
|
||||
int(11)
|
||||
int(45345)
|
||||
Done
|
25
Zend/tests/self_xor.phpt
Normal file
25
Zend/tests/self_xor.phpt
Normal file
|
@ -0,0 +1,25 @@
|
|||
--TEST--
|
||||
XORing strings
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$s = "123";
|
||||
$s1 = "test";
|
||||
$s2 = "45345some";
|
||||
|
||||
$s ^= 22;
|
||||
var_dump($s);
|
||||
|
||||
$s1 ^= 11;
|
||||
var_dump($s1);
|
||||
|
||||
$s2 ^= 33;
|
||||
var_dump($s2);
|
||||
|
||||
echo "Done\n";
|
||||
?>
|
||||
--EXPECTF--
|
||||
int(109)
|
||||
int(11)
|
||||
int(45312)
|
||||
Done
|
|
@ -1162,6 +1162,9 @@ ZEND_API int mod_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /* {{{ *
|
|||
return SUCCESS;
|
||||
}
|
||||
|
||||
if (op1 == result) {
|
||||
zval_dtor(result);
|
||||
}
|
||||
ZVAL_LONG(result, op1_lval % op2_lval);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
@ -1324,6 +1327,9 @@ ZEND_API int bitwise_or_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /
|
|||
op2_lval = Z_LVAL_P(op2);
|
||||
}
|
||||
|
||||
if (op1 == result) {
|
||||
zval_dtor(result);
|
||||
}
|
||||
ZVAL_LONG(result, op1_lval | op2_lval);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
@ -1379,6 +1385,9 @@ ZEND_API int bitwise_and_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
|||
op2_lval = Z_LVAL_P(op2);
|
||||
}
|
||||
|
||||
if (op1 == result) {
|
||||
zval_dtor(result);
|
||||
}
|
||||
ZVAL_LONG(result, op1_lval & op2_lval);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
@ -1434,6 +1443,9 @@ ZEND_API int bitwise_xor_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
|||
op2_lval = Z_LVAL_P(op2);
|
||||
}
|
||||
|
||||
if (op1 == result) {
|
||||
zval_dtor(result);
|
||||
}
|
||||
ZVAL_LONG(result, op1_lval ^ op2_lval);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
@ -1486,6 +1498,9 @@ ZEND_API int shift_left_function(zval *result, zval *op1, zval *op2 TSRMLS_DC) /
|
|||
}
|
||||
}
|
||||
|
||||
if (op1 == result) {
|
||||
zval_dtor(result);
|
||||
}
|
||||
ZVAL_LONG(result, op1_lval << op2_lval);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
@ -1538,6 +1553,9 @@ ZEND_API int shift_right_function(zval *result, zval *op1, zval *op2 TSRMLS_DC)
|
|||
}
|
||||
}
|
||||
|
||||
if (op1 == result) {
|
||||
zval_dtor(result);
|
||||
}
|
||||
ZVAL_LONG(result, op1_lval >> op2_lval);
|
||||
return SUCCESS;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue