]> granicus.if.org Git - php/commitdiff
Catch the specifical exception
authorXinchen Hui <laruence@php.net>
Fri, 3 Jul 2015 03:18:53 +0000 (11:18 +0800)
committerXinchen Hui <laruence@php.net>
Fri, 3 Jul 2015 03:18:53 +0000 (11:18 +0800)
Zend/tests/bug69957.phpt
Zend/tests/compound_assign_with_numeric_strings.phpt
Zend/tests/mod_001.phpt
tests/lang/operators/bitwiseShiftLeft_basiclong_64bit.phpt
tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt
tests/lang/operators/bitwiseShiftRight_basiclong_64bit.phpt
tests/lang/operators/bitwiseShiftRight_variationStr.phpt
tests/lang/operators/modulus_basiclong_64bit.phpt
tests/lang/operators/modulus_variationStr.phpt

index 5aa0edab21086e2f82f1f8d7dcc867fc1a06e072..d8d3a6f1fcebe56b930509565d401239dc310206 100644 (file)
@@ -7,7 +7,7 @@ try {
        $divisor = 0;
        $result = 1 / $divisor;
        var_dump($result);
-} catch (Throwable $t){
+} catch (DivisionByZeroError $t){
        echo "Variable div\n";
        printf("Type: %s\n", get_class($t));
        printf("Message: %s\n", $t->getMessage());
@@ -17,7 +17,7 @@ try {
        $divisor = 0;
        $result = 1 % $divisor;
        var_dump($result);
-} catch (Throwable $t){
+} catch (DivisionByZeroError $t){
        echo "\nVariable mod\n";
        printf("Type: %s\n", get_class($t));
        printf("Message: %s\n", $t->getMessage());
@@ -26,7 +26,7 @@ try {
 try {
        $result = 1 / 0;
        var_dump($result);
-} catch (Throwable $t){
+} catch (DivisionByZeroError $t){
        echo "\nLiteral div\n";
        printf("Type: %s\n", get_class($t));
        printf("Message: %s\n", $t->getMessage());
@@ -35,7 +35,7 @@ try {
 try {
        $result = 1 % 0;
        var_dump($result);
-} catch (Throwable $t){
+} catch (DivisionByZeroError $t){
        echo "\nLiteral mod\n";
        printf("Type: %s\n", get_class($t));
        printf("Message: %s\n", $t->getMessage());
@@ -44,7 +44,7 @@ try {
 try {
        $result = 1 / 0.0;
        var_dump($result);
-} catch (Throwable $t){
+} catch (DivisionByZeroError $t){
        echo "\nDouble div\n";
        printf("Type: %s\n", get_class($t));
        printf("Message: %s\n", $t->getMessage());
@@ -53,7 +53,7 @@ try {
 try {
        $result = 1 % 0.0;
        var_dump($result);
-} catch (Throwable $t){
+} catch (DivisionByZeroError $t){
        echo "\nDouble mod\n";
        printf("Type: %s\n", get_class($t));
        printf("Message: %s\n", $t->getMessage());
index fbfc1605ecf35b865bf4d3817dd14f7481942055..72c80b0afc164de013dd47d83be1ef21311607fe 100644 (file)
@@ -11,7 +11,7 @@ $n = "-1";
 try {
     $n <<= $n;
     var_dump($n);
-} catch (Throwable $e) {
+} catch (ArithmeticError $e) {
        echo "\nException: " . $e->getMessage() . "\n";
 }
 
@@ -23,7 +23,7 @@ $n = "-1";
 try {
   $n >>= $n;
   var_dump($n);
-} catch (Throwable $e) {
+} catch (ArithmeticError $e) {
        echo "\nException: " . $e->getMessage() . "\n";
 }
 
@@ -31,7 +31,7 @@ $n = "0";
 try{
   $n %= $n;
   var_dump($n);
-} catch (Throwable $e) {
+} catch (DivisionByZeroError $e) {
        echo "\nException: " . $e->getMessage() . "\n";
 }
 
index ff589e2feeeafe1d9ec3a79dba48f2c81fd88122..2c1ebc7cc2b1ef63d0ea0961aa66d64cf956e738 100644 (file)
@@ -9,7 +9,7 @@ $b = array();
 try {
     $c = $a % $b;
     var_dump($c);
-} catch (Throwable $e) {
+} catch (DivisionByZeroError $e) {
        echo "Exception: " . $e->getMessage() . "\n";
 }
 
index 380beca219eafa7460908f3d0f0f187b98c20d0e..99626da6f13bbdda8c63fa7ca095b3ac7a2231be 100644 (file)
@@ -27,7 +27,7 @@ foreach ($longVals as $longVal) {
          echo "--- testing: $longVal << $otherVal ---\n";
          try {
         var_dump($longVal<<$otherVal);
-      } catch (Throwable $e) {
+      } catch (ArithmeticError $e) {
         echo "Exception: " . $e->getMessage() . "\n";
       }
    }
@@ -38,7 +38,7 @@ foreach ($otherVals as $otherVal) {
          echo "--- testing: $otherVal << $longVal ---\n";
          try {
         var_dump($otherVal<<$longVal);
-      } catch (Throwable $e) {
+      } catch (ArithmeticError $e) {
         echo "Exception: " . $e->getMessage() . "\n";
       }
    }
index 174d947445fa94ef97be14069e72ef8aa7edb434..d5888d837f98f7d4dd863a7911c26780c51f04b8 100644 (file)
@@ -19,7 +19,7 @@ foreach ($strVals as $strVal) {
          echo "--- testing: '$strVal' << '$otherVal' ---\n";\r
       try {      \r
         var_dump($strVal<<$otherVal);\r
-      } catch (Throwable $e) {\r
+      } catch (ArithmeticError $e) {\r
         echo "Exception: " . $e->getMessage() . "\n";\r
       }\r
    }\r
index c85c44031238ab18a294bd2c301d0a1edb121f31..65e7e826b8b9d645c1473abeecff5fd1ea5384c6 100644 (file)
@@ -27,7 +27,7 @@ foreach ($longVals as $longVal) {
          echo "--- testing: $longVal >> $otherVal ---\n";
       try {
         var_dump($longVal>>$otherVal);
-      } catch (Throwable $e) {
+      } catch (ArithmeticError $e) {
         echo "Exception: " . $e->getMessage() . "\n";
       }
    }
@@ -38,7 +38,7 @@ foreach ($otherVals as $otherVal) {
          echo "--- testing: $otherVal >> $longVal ---\n";
          try {
         var_dump($otherVal>>$longVal);
-      } catch (Throwable $e) {
+      } catch (ArithmeticError $e) {
         echo "Exception: " . $e->getMessage() . "\n";
       }
    }
index 1c3277acc8069e08b7c1f68dede1eb364c865130..a86d0cfddb21b4874cde746c569c3b2d3db6396d 100644 (file)
@@ -15,7 +15,7 @@ foreach ($strVals as $strVal) {
          echo "--- testing: '$strVal' >> '$otherVal' ---\n";
          try {
         var_dump($strVal>>$otherVal);
-      } catch (Throwable $e) {
+      } catch (ArithmeticError $e) {
         echo "Exception: " . $e->getMessage() . "\n";
       }
    }
index c2db77c12026387eecf18737829b22b96853c37f..6806bd53a8455dcfec8f3d6071d57015f70b56fe 100644 (file)
@@ -27,7 +27,7 @@ foreach ($longVals as $longVal) {
          echo "--- testing: $longVal % $otherVal ---\n";
          try {
            var_dump($longVal%$otherVal);
-      } catch (Throwable $e) {
+      } catch (DivisionByZeroError $e) {
         echo "Exception: " . $e->getMessage() . "\n";
       }
    }
@@ -38,7 +38,7 @@ foreach ($otherVals as $otherVal) {
          echo "--- testing: $otherVal % $longVal ---\n";
          try {
         var_dump($otherVal%$longVal);
-      } catch (Throwable $e) {
+      } catch (DivisionByZeroError $e) {
         echo "Exception: " . $e->getMessage() . "\n";
       }
    }
index 49487000b3ce1d0b5d4fc206c6f5e2cd8ac92a09..c647ecd38057e512e6397e823df520379f2b3cf4 100644 (file)
@@ -15,7 +15,7 @@ foreach ($strVals as $strVal) {
          echo "--- testing: '$strVal' % '$otherVal' ---\n";\r
       try {\r
         var_dump($strVal%$otherVal);\r
-      } catch (Throwable $e) {\r
+      } catch (DivisionByZeroError $e) {\r
         echo "Exception: " . $e->getMessage() . "\n";\r
       }\r
    }\r