Bug #81600 [Opn->Dup]: Require once does not throw a fatal error
| From: | nikic@php.net | Date: | Mon, 08 Nov 2021 15:18:04 +0000 |
| Subject: | Bug #81600 [Opn->Dup]: Require once does not throw a fatal error | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-237613@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=81600&edit=1
ID: 81600
Updated by: nikic@php.net
Reported by: 7snovic at gmail dot com
Summary: Require once does not throw a fatal error
-Status: Open
+Status: Duplicate
Type: Bug
Package: *Directory/Filesystem functions
Operating System: Ubuntu 20
PHP Version: 8.0.12
Block user comment: N
Private report: N
New Comment:
Assuming you have ignore_repeated_errors enabled, this is a duplicate of bug #81591.
Previous Comments:
------------------------------------------------------------------------
[2021-11-08 15:01:49] 7snovic at gmail dot com
Description:
------------
require & require_once should throw a Fatal error exception or fatal_error message when the
required file does not exist.
but it only throws the warning message.
Version:
PHP 8.0.12 (cli) (built: Oct 22 2021 12:34:48) ( NTS )
Copyright (c) The PHP Group
Zend Engine v4.0.12, Copyright (c) Zend Technologies
with Zend OPcache v8.0.12, Copyright (c), by Zend Technologies
------
The list of modules my PHP compiled with:
$ php8.0 -m
bz2
calendar
Core
ctype
curl
date
dom
exif
FFI
fileinfo
filter
ftp
gd
gettext
hash
iconv
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
SimpleXML
sockets
sodium
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
xml
xmlreader
xmlwriter
xsl
Zend OPcache
zip
zlib
[Zend Modules]
Zend OPcache
Test script:
---------------
<?php
require_once("non-existing-file");
Expected result:
----------------
PHP Warning: require_once(non-existing-file): Failed to open stream: No such file or directory in
/var/www/test.php on line 2
PHP Fatal error: Uncaught Error: Failed opening required 'non-existing-file'
(include_path='.:/usr/share/php') in /var/www/test.php:2
Stack trace:
#0 {main}
thrown in /var/www/test.php on line 2
Actual result:
--------------
PHP Warning: require_once(non-existing-file): Failed to open stream: No such file or directory in
/var/www/test.php on line 2
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=81600&edit=1