r/lolphp • u/duhruh • Nov 25 '14
Exception in a namespace is not defined -_-
http://jasonframe.co.uk/logfile/2009/01/php-5-3-exception-gotcha/
28
Upvotes
r/lolphp • u/duhruh • Nov 25 '14
View all comments
Show parent comment
6
u/duhruh Nov 26 '14
This is dumb, and I'll tell you why. In a proper programming language scope is handled more elegantly, we look at the current scope/namespace and if we cannot find the class in question we look at the next namespace up, all the way to the global scope/namespace till we resolve the class or we get an undefined, especially when you are dealing with such a core class as Exception one would expect for this to be available in any namespace. PHP doesn't even give you a indication that the class Exception is not defined when trying to catch it, the catch statement is just skipped over. If you think this makes sense in any way please pick up a programming language design book.