Created
July 23, 2015 18:15
-
-
Save kojiromike/ca8577f3145a13d8ad00 to your computer and use it in GitHub Desktop.
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
$ cat catchtest.php | |
<?php | |
interface FooFail {} | |
interface BarFail {} | |
class YesFail extends Exception implements FooFail, BarFail {} | |
class NoFail implements FooFail {} | |
try { throw new YesFail; } | |
catch (FooFail $e) { echo "Caught the foo\n"; } | |
try { throw new YesFail; } | |
catch (BarFail $e) { echo "Passed the bar\n"; } | |
try { throw new NoFail; } | |
catch (FooFail $e) { echo "Caught another foo\n"; } | |
$ docker run --rm -i php:5.3 php < catchtest.php | |
Caught the foo | |
Passed the bar | |
Fatal error: Exceptions must be valid objects derived from the Exception base class in - on line 13 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment