Edit report at https://bugs.php.net/bug.php?id=60053&edit=1
ID: 60053 Comment by: anon at anon dot anon Reported by: anon at anon dot anon Summary: Allow throwing of strings and things Status: Open Type: Feature/Change Request Package: Class/Object related PHP Version: Irrelevant Block user comment: N Private report: N New Comment: I'd like to add that since PHP is so dynamically-typed and prefers to cock programs up at run time instead of letting them be robustly specified from the get go, I once thought I *could* do this anyway. It's a valid syntax, but the first time one of my "exceptions" was thrown it blew up. Previous Comments: ------------------------------------------------------------------------ [2011-10-13 13:32:11] anon at anon dot anon Description: ------------ Here's my suggestion: when throwing something that's not an Exception, use it as the message of a new Exception (instead of dying). I.e., throw $x; where !($x instanceof Exception) would be interpreted as: throw new Exception($x); Then I could do this: throw "I can't be arsed to type new Exception() everywhere"; >inb4 one person looks at and rejects this for some bureaucratic reason and >it's never considered again. >I mean, er, have a nice day. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=60053&edit=1