summaryrefslogtreecommitdiff
path: root/Zend/tests/compound_assign_with_numeric_strings.phpt
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2015-04-06 14:30:05 +0300
committerDmitry Stogov <dmitry@zend.com>2015-04-06 14:30:05 +0300
commitcae0147ed3ceb55fcb1bc059b8e8ea6a36ea69a8 (patch)
tree4ca16379ac8d5cab749f07747e2599ee23a4d175 /Zend/tests/compound_assign_with_numeric_strings.phpt
parentcaf9219dea58dcc6ef6da2b3b86a1e9808363bff (diff)
downloadphp-git-cae0147ed3ceb55fcb1bc059b8e8ea6a36ea69a8.tar.gz
Fixed weird operators behavior. Division by zero now emits warning and returns +/-INF, modulo by zero and intdid() throws an exception, shifts by negative offset throw exceptions. Compile-time evaluation of division by zero is disabled.
Diffstat (limited to 'Zend/tests/compound_assign_with_numeric_strings.phpt')
-rw-r--r--Zend/tests/compound_assign_with_numeric_strings.phpt33
1 files changed, 21 insertions, 12 deletions
diff --git a/Zend/tests/compound_assign_with_numeric_strings.phpt b/Zend/tests/compound_assign_with_numeric_strings.phpt
index 803650cb02..518ed9ee7e 100644
--- a/Zend/tests/compound_assign_with_numeric_strings.phpt
+++ b/Zend/tests/compound_assign_with_numeric_strings.phpt
@@ -8,20 +8,32 @@ $n <<= $n;
var_dump($n);
$n = "-1";
-$n <<= $n;
-var_dump($n);
+try {
+ $n <<= $n;
+ var_dump($n);
+} catch (Exception $e) {
+ echo "\nException: " . $e->getMessage() . "\n";
+}
$n = "65";
$n >>= $n;
var_dump($n);
$n = "-1";
-$n >>= $n;
-var_dump($n);
+try {
+ $n >>= $n;
+ var_dump($n);
+} catch (Exception $e) {
+ echo "\nException: " . $e->getMessage() . "\n";
+}
$n = "0";
-$n %= $n;
-var_dump($n);
+try{
+ $n %= $n;
+ var_dump($n);
+} catch (Exception $e) {
+ echo "\nException: " . $e->getMessage() . "\n";
+}
$n = "-1";
$n %= $n;
@@ -29,13 +41,10 @@ var_dump($n);
--EXPECTF--
int(0)
-Warning: Bit shift by negative number in %s on line %d
-bool(false)
+Exception: Bit shift by negative number
int(0)
-Warning: Bit shift by negative number in %s on line %d
-bool(false)
+Exception: Bit shift by negative number
-Warning: Division by zero in %s on line %d
-bool(false)
+Exception: Division by zero
int(0)