#50853 [Opn->Bgs]: require does not throw E_ERROR for all failrues
| From: | degeberg@php.net | Date: | Wed, 27 Jan 2010 06:46:21 +0000 |
| Subject: | #50853 [Opn->Bgs]: require does not throw E_ERROR for all failrues | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-3783@lists.php.net to get a copy of this message | ||
ID: 50853
Updated by: degeberg@php.net
Reported By: miqrogroove at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: Documentation problem
Operating System: *
PHP Version: 5.3.1
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
It isn't require() or include() that fails when you try including an
syntactically incorrect file.
As the manual says: "Files are included based on the file path given
or, if none is given, the include_path specified. The include()
construct will emit a warning if it cannot find a file; this is
different behavior from require(), which will emit a fatal error."
If you try doing something like fopen(%&/%!, 'r'); you will also get a
parse error even though fopen()'s failure error level is E_WARNING.
That's not because fopen() is failing but because the PHP file simply
isn't valid.
You simply cannot continue past a parse error. It doesn't make sense
trying to figure out if you meant something else or if you're really
just feeding it junk.
Previous Comments:
------------------------------------------------------------------------
[2010-01-27 02:35:07] miqrogroove at gmail dot com
Description:
------------
"require() is identical to include() except upon failure it will also
produce a fatal E_ERROR level error."
http://www.php.net/require
This is not really accurate because E_PARSE can prevent execution of
the
required file. If someone were to use error_reporting(E_ERROR) based
on
the advice above, nothing would get reported in those situations.
Since
this is also never mentioned on the include() page, it is a bit
misleading.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=50853&edit=1