From e8f992c163eff2fc5ebf44d9a39599ed70463253 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Fri, 3 Jul 2015 11:18:53 +0800 Subject: [PATCH] Catch the specifical exception --- Zend/tests/bug69957.phpt | 12 ++++++------ Zend/tests/compound_assign_with_numeric_strings.phpt | 6 +++--- Zend/tests/mod_001.phpt | 2 +- .../operators/bitwiseShiftLeft_basiclong_64bit.phpt | 4 ++-- .../bitwiseShiftLeft_variationStr_64bit.phpt | 2 +- .../operators/bitwiseShiftRight_basiclong_64bit.phpt | 4 ++-- .../operators/bitwiseShiftRight_variationStr.phpt | 2 +- tests/lang/operators/modulus_basiclong_64bit.phpt | 4 ++-- tests/lang/operators/modulus_variationStr.phpt | 2 +- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Zend/tests/bug69957.phpt b/Zend/tests/bug69957.phpt index 5aa0edab21..d8d3a6f1fc 100644 --- a/Zend/tests/bug69957.phpt +++ b/Zend/tests/bug69957.phpt @@ -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()); diff --git a/Zend/tests/compound_assign_with_numeric_strings.phpt b/Zend/tests/compound_assign_with_numeric_strings.phpt index fbfc1605ec..72c80b0afc 100644 --- a/Zend/tests/compound_assign_with_numeric_strings.phpt +++ b/Zend/tests/compound_assign_with_numeric_strings.phpt @@ -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"; } diff --git a/Zend/tests/mod_001.phpt b/Zend/tests/mod_001.phpt index ff589e2fee..2c1ebc7cc2 100644 --- a/Zend/tests/mod_001.phpt +++ b/Zend/tests/mod_001.phpt @@ -9,7 +9,7 @@ $b = array(); try { $c = $a % $b; var_dump($c); -} catch (Throwable $e) { +} catch (DivisionByZeroError $e) { echo "Exception: " . $e->getMessage() . "\n"; } diff --git a/tests/lang/operators/bitwiseShiftLeft_basiclong_64bit.phpt b/tests/lang/operators/bitwiseShiftLeft_basiclong_64bit.phpt index 380beca219..99626da6f1 100644 --- a/tests/lang/operators/bitwiseShiftLeft_basiclong_64bit.phpt +++ b/tests/lang/operators/bitwiseShiftLeft_basiclong_64bit.phpt @@ -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"; } } diff --git a/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt b/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt index 174d947445..d5888d837f 100644 --- a/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt +++ b/tests/lang/operators/bitwiseShiftLeft_variationStr_64bit.phpt @@ -19,7 +19,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"; } } diff --git a/tests/lang/operators/bitwiseShiftRight_basiclong_64bit.phpt b/tests/lang/operators/bitwiseShiftRight_basiclong_64bit.phpt index c85c440312..65e7e826b8 100644 --- a/tests/lang/operators/bitwiseShiftRight_basiclong_64bit.phpt +++ b/tests/lang/operators/bitwiseShiftRight_basiclong_64bit.phpt @@ -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"; } } diff --git a/tests/lang/operators/bitwiseShiftRight_variationStr.phpt b/tests/lang/operators/bitwiseShiftRight_variationStr.phpt index 1c3277acc8..a86d0cfddb 100644 --- a/tests/lang/operators/bitwiseShiftRight_variationStr.phpt +++ b/tests/lang/operators/bitwiseShiftRight_variationStr.phpt @@ -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"; } } diff --git a/tests/lang/operators/modulus_basiclong_64bit.phpt b/tests/lang/operators/modulus_basiclong_64bit.phpt index c2db77c120..6806bd53a8 100644 --- a/tests/lang/operators/modulus_basiclong_64bit.phpt +++ b/tests/lang/operators/modulus_basiclong_64bit.phpt @@ -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"; } } diff --git a/tests/lang/operators/modulus_variationStr.phpt b/tests/lang/operators/modulus_variationStr.phpt index 49487000b3..c647ecd380 100644 --- a/tests/lang/operators/modulus_variationStr.phpt +++ b/tests/lang/operators/modulus_variationStr.phpt @@ -15,7 +15,7 @@ foreach ($strVals as $strVal) { echo "--- testing: '$strVal' % '$otherVal' ---\n"; try { var_dump($strVal%$otherVal); - } catch (Throwable $e) { + } catch (DivisionByZeroError $e) { echo "Exception: " . $e->getMessage() . "\n"; } } -- 2.50.1