mirror of
https://github.com/php/php-src.git
synced 2024-09-21 09:57:23 +00:00
62ecf54f35
We can't destroy the result operand early, because the division might fail, in which case we need to preserve the original value. Place the division result in a temporary zval, and only copy it on success. Fixes oss-fuzz #35876.
17 lines
258 B
PHP
17 lines
258 B
PHP
--TEST--
|
|
Division by zero in compound assignment with refcounted operand
|
|
--FILE--
|
|
<?php
|
|
$h = "1";
|
|
$h .= "2";
|
|
try {
|
|
$h /= 0;
|
|
} catch (DivisionByZeroError $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
var_dump($h);
|
|
?>
|
|
--EXPECT--
|
|
Division by zero
|
|
string(2) "12"
|