note 120136 added to exception.construct
| From: | ryan dot jentzsch at gmail dot com | Date: | Tue, 08 Nov 2016 23:45:14 +0000 |
| Subject: | note 120136 added to exception.construct | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-207055@lists.php.net to get a copy of this message | ||
Note that the code parameter is not the same as exit($code).
Also, the code argument in PHP 7 (possibly earlier versions) is cast to an int including negative
values. The code below is completely valid:
<?php
try
{
throw new \Exception('Testing', -12.12);
}
catch (\Exception $exception)
{
$code = $exception->getCode();
if ($code < 0)
{
exit(abs($code));
}
}
----
Server IP: 72.52.91.14
Probable Submitter: 209.33.217.66
----
Manual Page -- http://php.net/manual/en/exception.construct.php
Edit -- https://master.php.net/note/edit/120136
Del: integrated -- https://master.php.net/note/delete/120136/integrated
Del: useless -- https://master.php.net/note/delete/120136/useless
Del: bad code -- https://master.php.net/note/delete/120136/bad+code
Del: spam -- https://master.php.net/note/delete/120136/spam
Del: non-english -- https://master.php.net/note/delete/120136/non-english
Del: in docs -- https://master.php.net/note/delete/120136/in+docs
Del: other reasons-- https://master.php.net/note/delete/120136
Reject -- https://master.php.net/note/reject/120136
Search -- https://master.php.net/manage/user-notes.php