Req #72089 [Com]: require() throws fatal error instead of exception
| From: | cryptomister99 at gmail dot com | Date: | Mon, 03 Jan 2022 18:39:04 +0000 |
| Subject: | Req #72089 [Com]: require() throws fatal error instead of exception | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-238741@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72089&edit=1
ID: 72089
Comment by: cryptomister99 at gmail dot com
Reported by: paulobitfranca at gmail dot com
Summary: require() throws fatal error instead of exception
Status: Closed
Type: Feature/Change Request
Package: *General Issues
Operating System: Linux
PHP Version: 7.0.5
Block user comment: N
Private report: N
New Comment:
> Generally, that has already been done for PHP 7.0.0 where
> reasonable and possible, see
> <https://wiki.php.net/rfc/engine_exceptions_for_php7>.
That RFC at the beginning states: Status: Implemented (in PHP 7.0)
However, part of the proposal in the Hierarchy section https://wiki.php.net/rfc/engine_exceptions_for_php7#hierarchy
talks about BaseException. I think is out of dated (Throwable as of PHP 7.0)
Do you have an updated version of that RFC concerning PHP 7.0?
Previous Comments:
------------------------------------------------------------------------
[2020-06-05 07:47:23] nikic@php.net
Related To: Bug #74475
------------------------------------------------------------------------
[2020-06-05 07:46:55] nikic@php.net
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e949f306be9e7d54a700cccd5b9af9711615b43f
Log: Fixed bug #72089: Throw Error on require failure
------------------------------------------------------------------------
[2020-05-29 15:32:11] nikic@php.net
Retargeting this FR for only the issue mentioned in OP, namely that require throws a fatal error.
Please report separate issues for other fatal errors (after checking that there are no existing
ones). Otherwise this is not actionable.
I've opened https://github.com/php/php-src/pull/5641 to
address require in particular.
------------------------------------------------------------------------
[2017-11-28 20:48:12] ryan dot jentzsch at gmail dot com
As an actual case where this issue is a valid concern. Pseudocode that illustrates the issue:
<?php
try {
SoapClient::__constructor($wsdl)
} catch (\Throwable $t) {
// Never executed because ANYTIME the constructor can not PARSE the WSDL a script exiting fatal
is thrown and not caught!
// The SOAP implementation in PHP offers ZERO fault tolerance.
// We can't degrade gracefully.
// All processing stops and the script is exited!
// Why in the name of sanity is a SOAP PARSE issue NOT throwing a SOAPFault and instead we get a
fatal error?
}
------------------------------------------------------------------------
[2017-07-27 21:28:48] spam2 at rhsoft dot net
it's a general issue - with having Ãeverything* as exception you can esily write code which
handles 99.9% of all cases in a very cheap try{] while handle servers missing something in the catch
part - unhandeled you get the same result as now but *you can* handle it properly
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=72089
--
Edit this bug report at https://bugs.php.net/bug.php?id=72089&edit=1