Affected page
https://www.php.net/manual/en/reserved.exceptions.php
Current issue
From https://www.php.net/manual/en/class.error.php and https://www.php.net/manual/en/class.exception.php, it seems that Error is thrown by PHP and Exception is for userland code:
Exception is the base class for all user exceptions.
Error is the base class for all internal PHP errors.
This is not accurate and not complete.
Suggested improvement
PHP also throws Exception subclasses. But the semantic meaning is different, apparently.
https://github.com/php/policies/blob/main/coding-standards-and-naming.rst#throwables
The Error hierarchy MUST NOT be used for errors that are expected to be thrown (and caught) during normal operation of a PHP program.
As an example, a parsing function that is expected to be used with untrusted input must not throw an Error if the input is malformed. Similarly a function that interacts with the network must not throw an Error if the network operation fails. Any Error that is thrown should usually result in a reasonably obvious fix in the PHP program.
Tim also said that Error is not supposed to be caught, only Exception is.
Additional context (optional)
No response
Affected page
https://www.php.net/manual/en/reserved.exceptions.php
Current issue
From https://www.php.net/manual/en/class.error.php and https://www.php.net/manual/en/class.exception.php, it seems that Error is thrown by PHP and Exception is for userland code:
This is not accurate and not complete.
Suggested improvement
PHP also throws Exception subclasses. But the semantic meaning is different, apparently.
https://github.com/php/policies/blob/main/coding-standards-and-naming.rst#throwables
Tim also said that Error is not supposed to be caught, only Exception is.
Additional context (optional)
No response