Forgotten Throw
<?php
class MyException extends \Exception {}
if ($error !== false) {
// This looks like 'throw' was omitted
new MyException();
}
Sometimes, the throw keyword is forgotten, even as it is needed. It is difficult to realize it is missing: PHP instantiates correctly the exception, yet it immediately ignores it, as there is no usage of that exception: no error is reported. One need to identify a situation with an error, understand that the error is missing.
See Also
PHP Features
Last updated: 10 September 2026