note 118056 added to language.exceptions
| From: | hweidmann at online dot de | Date: | Sat, 26 Sep 2015 20:20:51 +0000 |
| Subject: | note 118056 added to language.exceptions | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-203856@lists.php.net to get a copy of this message | ||
catch doesn't check for the existence of the Exception class, so avoid typo.
<?php
class MyException extends Exception
{
...
}
try
{
throw new MyException(...);
}
catch (MuException $e) // <--- typo
{
...
}
?>
You WON'T get
Fatal error: Class MuException could not be loaded ...
You WILL get
Fatal error: Uncaught exception 'MyException' ...
----
Server IP: 72.52.91.14
Probable Submitter: 84.133.192.176
----
Manual Page -- http://php.net/manual/en/language.exceptions.php
Edit -- https://master.php.net/note/edit/118056
Del: integrated -- https://master.php.net/note/delete/118056/integrated
Del: useless -- https://master.php.net/note/delete/118056/useless
Del: bad code -- https://master.php.net/note/delete/118056/bad+code
Del: spam -- https://master.php.net/note/delete/118056/spam
Del: non-english -- https://master.php.net/note/delete/118056/non-english
Del: in docs -- https://master.php.net/note/delete/118056/in+docs
Del: other reasons-- https://master.php.net/note/delete/118056
Reject -- https://master.php.net/note/reject/118056
Search -- https://master.php.net/manage/user-notes.php