Created
October 19, 2011 13:26
-
-
Save Reinmar/1298274 to your computer and use it in GitHub Desktop.
PHP sucks
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
<?php | |
namespace x; | |
require 'catch_me2.php'; | |
error_reporting(E_ALL | E_STRICT); | |
ini_set('display_errors', 1); | |
try { | |
\y\shittyCode(); | |
} | |
catch (Exception $e) { | |
echo 'Gotcha!'; | |
} | |
//Guess what? Uncaught exception 'Exception' with message 'catch me if you can' :) | |
//No error caused by lack of Exception class in this namespace |
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
<?php | |
namespace y; | |
function shittyCode() { | |
throw new \Exception('catch me if you can'); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I know I can, but then it wouldn't be so tricky :> In the case I was working on the exception was thrown far far away, so it took me a while before I've found wtf.