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: 2020-06-05 07:47 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: Duplicate Package: Scripting Engine problem
PHP Version: 7.1.5RC1 OS: Irrelevant
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: spam2 at rhsoft dot net
New email:
PHP Version: OS:

 

 [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
 [2020-06-05 07:47 UTC] nikic@php.net
-Status: Open +Status: Duplicate
 [2020-06-05 07:47 UTC] nikic@php.net
Duplicate of bug #72089, fixed in PHP 8.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed Apr 24 06:01:29 2024 UTC