Bug #74475 [NEW]: require() REALLY should throw exceptions

From: Date: Wed, 19 Apr 2017 18:54:19 +0000
Subject: Bug #74475 [NEW]: require() REALLY should throw exceptions
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-208669@lists.php.net to get a copy of this message
From: spam2 at rhsoft dot net Operating system: Irrelevant PHP version: 7.1.5RC1 Package: Scripting Engine problem Bug Type: Bug Bug description:require() REALLY should throw exceptions Description: ------------ this is REALLY a problem when you have a handler for 3rd party modules where you can't say "uhm please use include()" when your whole application get stopped instead procude a pretty page with navigation and a clear error message the same problem with: https://bugs.php.net/bug.php?id=51407 https://bugs.php.net/bug.php?id=73451 PLEASE - fix all that "Fatal error" stuff and make it catchable Warning: require(non-existing): failed to open stream: No such file or directory in /mnt/data/downloads/test.php on line 4 Fatal error: require(): Failed opening required 'non-existing' (include_path='.:/Volumes/dune/www-servers/phpincludes:/usr/share/pear:/usr/share/php') in /mnt/data/downloads/test.php on line 4 Test script: --------------- <?php try { require('non-existing'); } catch(Throwable $exception) { echo $exception; } ?> -- Edit bug report at https://bugs.php.net/bug.php?id=74475&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=74475&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=74475&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=74475&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=74475&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=74475&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=74475&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=74475&r=needscript Try newer version: https://bugs.php.net/fix.php?id=74475&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=74475&r=support Expected behavior: https://bugs.php.net/fix.php?id=74475&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=74475&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=74475&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=74475&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74475&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=74475&r=dst IIS Stability: https://bugs.php.net/fix.php?id=74475&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=74475&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=74475&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=74475&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=74475&r=mysqlcfg

« previous php.bugs (#208669) next »