php-src/Zend/tests/div_by_zero_compound_with_conversion.phpt
Nikita Popov 540fed1b36 Fix leak on div by zero compound assignment with coercion
The result == op1 check did not work properly here, because op1
was &op1_copy at this point. Move the division by zero reporting
out of the _base function, so it can check the original op1.
2021-07-01 14:50:18 +02:00

15 lines
261 B
PHP

--TEST--
Division by zero in compound operator with type coercion
--FILE--
<?php
$x = 42;
try {
$$x /= 0;
} catch (DivisionByZeroError $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECTF--
Warning: Undefined variable $42 in %s on line %d
Division by zero