Doc #80479 [Opn]: Exception code is defaulted (apparently) to integer zero, but not documented
| From: | peehaa@php.net | Date: | Thu, 03 Dec 2020 13:40:44 +0000 |
| Subject: | Doc #80479 [Opn]: Exception code is defaulted (apparently) to integer zero, but not documented | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-18185@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=80479&edit=1
ID: 80479
Updated by: peehaa@php.net
Reported by: scott at scott-corcoran dot com
Summary: Exception code is defaulted (apparently) to integer
zero, but not documented
Status: Open
Type: Documentation Problem
Package: Documentation problem
Operating System: Debian
PHP Version: 7.3.25
Block user comment: N
Private report: N
New Comment:
It is documented:
https://www.php.net/manual/en/exception.construct.php
https://www.php.net/manual/en/class.exception.php
Where did you find those docs?
Previous Comments:
------------------------------------------------------------------------
[2020-12-03 13:27:00] scott at scott-corcoran dot com
Description:
------------
<?php
try
{
throw new Exception('xxxx');
}
catch(Exception $x)
{
echo serialize($x->getCode());
}
?>
i:0;
Documentation,
class Exception:
Methods
o public Exception::__construct NULL ([string $message = ""], [int $code],
[Exception $previous])
Test script:
---------------
As in the description:
try
{
throw new Exception('xxxx');
}
catch(Exception $x)
{
if (serialize($x->getCode() == 's:0;')
exit(0);
throw new Exception('Invalid exception code default');
}
Expected result:
----------------
silence
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=80479&edit=1