note 127186 added to class.exception
| From: | WalterAlexandre at main dot php dot net | Date: | Mon, 20 Jun 2022 12:31:24 +0000 |
| Subject: | note 127186 added to class.exception | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-218602@lists.php.net to get a copy of this message | ||
On php 5.6, if you use a constant do define the code you get an error (exception):
class foo {
const EXCODE = 1;
try {
throw new Exception("Some message", EXCODE); // don't work.
}
}
But if you use a cast, it will work:
...
throw new Exception("Some message", (int) EXCODE); // it works.
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.12.131 (proxied: 2804:16c:514:d00:c986:c118:a526:85b4)
----
Manual Page -- https://php.net/manual/en/class.exception.php
Edit -- https://main.php.net/note/edit/127186
Del: integrated -- https://main.php.net/note/delete/127186/integrated
Del: useless -- https://main.php.net/note/delete/127186/useless
Del: bad code -- https://main.php.net/note/delete/127186/bad+code
Del: spam -- https://main.php.net/note/delete/127186/spam
Del: non-english -- https://main.php.net/note/delete/127186/non-english
Del: in docs -- https://main.php.net/note/delete/127186/in+docs
Del: other reasons-- https://main.php.net/note/delete/127186
Reject -- https://main.php.net/note/reject/127186
Search -- https://main.php.net/manage/user-notes.php