|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #3403 duplicate loading of include files
Submitted: 2000-02-04 09:42 UTC Modified: 2000-07-28 02:02 UTC
From: terado at hotmail dot com Assigned:
Status: Closed Package: Other
PHP Version: 3.0.14 OS: All
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Bug Type:
From: terado at hotmail dot com
New email:
PHP Version: OS:


 [2000-02-04 09:42 UTC] terado at hotmail dot com
This probably is not strictly a bug but is certainly something that does not follow normal programming methods and so is important.

When you include or require a file there is no logical way to prevent duplicate loading.  So for example if there are three files as:

//File 1 - file1.php3
include "";
include "";

//File 2 -
include "";

//File 3 -
function testimp(){
    print "hello\n";

This will not work, also using require.  I would either expect that I could put something like #ifndef to prevent reinclusion or I would expect this to infact be the difference that require would play.

It is also a real pain to get around this problem.

Hope this is clear, and relevant.

Thanks, Nick


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-28 02:02 UTC]
on php4 you have include_once() and require_once()

for php3 you can do:

---8<----- -----------------
if(! $included_filename){
... whatever code you want, including function definitions ...
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Sat Apr 01 20:03:35 2023 UTC