|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35176 include()/require()/*_once() produce wrong error messages about main()
Submitted: 2005-11-09 21:50 UTC Modified: 2005-11-15 12:18 UTC
From: subscription at nazarenko dot net Assigned: dmitry (profile)
Status: Closed Package: Scripting Engine problem
PHP Version: 5CVS-2005-11-10 (CVS) OS: *
Private report: No CVE-ID: None
 [2005-11-09 21:50 UTC] subscription at nazarenko dot net
According to this page:

the misbehaviour was stopped in PHP 4.3.2, however it is still present in the latest 5.1.x snapshot.

In addition when require_once() or include_once() call fails and "html_errors" is "On" the error message HTML link points to the same function "require()" or "include()", without the _once() part in it.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-11-09 22:06 UTC] subscription at nazarenko dot net
A sample script:


Produces this HTML (html_errors=on):

<b>Warning</b>:  main(fake) [<a href=''>function.main.php</a>]: failed to open stream: No such file or directory in <b>x.php</b> on line <b>2</b><br />

<b>Fatal error</b>:  main() [<a href=''>function.require.php</a>]: Failed opening required 'fake' (include_path='.:/usr/lib/php') in <b>x.php</b> on line <b>2</b><br />

This illustrates both points:  the erroneous main() function as well as the wrong html link  (should be funtion.require-once.php)
 [2005-11-09 22:14 UTC] subscription at nazarenko dot net
Sorry, the script above should have

 [2005-11-09 22:32 UTC]
The docs are wrong - I can see the same problem in 4.3.6 and 4.3.10.
Also, I don't see an easy way to fix it, since include_*()/require_*() aren't really functions, but language constructs. 
 [2005-11-10 09:23 UTC]
See also bug #21499.
 [2005-11-10 10:17 UTC]
I removed the "No longer points here" column from function.main in CVS.

This is maybe not easy to fix but it's still a bug:

1. Prior to function.require error message, there's a bogus function.main error message - it should be silented.

2. require_once() points to function.require and not function.require-once, include_once() parallel.
 [2005-11-15 12:18 UTC]
Fixed in CVS HEAD and PHP_5_1.
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Tue Jul 05 06:05:45 2022 UTC