|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2021-11-08 15:18 UTC] nikic@php.net
-Status: Open
+Status: Duplicate
[2021-11-08 15:18 UTC] nikic@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 13:00:01 2025 UTC |
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