forked from php/php-src
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for catch without variable
- Loading branch information
Showing
7 changed files
with
168 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--TEST-- | ||
Catching an exception without catch variable | ||
--FILE-- | ||
<?php | ||
|
||
try | ||
{ | ||
throw new Exception; | ||
} | ||
catch(Exception) | ||
{ | ||
echo "Caught\n"; | ||
} | ||
|
||
?> | ||
===DONE=== | ||
--EXPECT-- | ||
Caught | ||
===DONE=== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--TEST-- | ||
Catching an exception without catch variable, multiple times | ||
--FILE-- | ||
<?php | ||
|
||
try | ||
{ | ||
throw new Exception; | ||
} | ||
catch(RuntimeException) | ||
{ | ||
echo "Should not be caught\n"; | ||
} | ||
catch(Exception) | ||
{ | ||
echo "Caught\n"; | ||
} | ||
catch(Throwable) | ||
{ | ||
echo "Should not be caught either\n"; | ||
} | ||
|
||
?> | ||
===DONE=== | ||
--EXPECT-- | ||
Caught | ||
===DONE=== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--TEST-- | ||
Catching an exception with and without catch variable, multiple times | ||
--FILE-- | ||
<?php | ||
|
||
try | ||
{ | ||
throw new Exception; | ||
} | ||
catch(RuntimeException $e) | ||
{ | ||
echo "Should not be caught\n"; | ||
} | ||
catch(Exception) | ||
{ | ||
echo "Caught\n"; | ||
} | ||
catch(Throwable $e) | ||
{ | ||
echo "Should not be caught either\n"; | ||
} | ||
|
||
?> | ||
===DONE=== | ||
--EXPECT-- | ||
Caught | ||
===DONE=== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters