php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #74475 require() REALLY should throw exceptions
Submitted: 2017-04-19 18:54 UTC Modified: 2017-08-12 00:50 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:1 (50.0%)
From: spam2 at rhsoft dot net Assigned:
Status: Open Package: Scripting Engine problem
PHP Version: 7.1.5RC1 OS: Irrelevant
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2017-04-19 18:54 UTC] spam2 at rhsoft dot net
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;
 }
?>



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-08-12 00:50 UTC] ajf@php.net
-Type: Bug +Type: Feature/Change Request
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Fri May 24 13:01:27 2019 UTC