|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12203 Inconsistent __FILE__ contents when using require/require_once
Submitted: 2001-07-17 08:20 UTC Modified: 2002-06-18 06:27 UTC
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: adam at iewebs dot com Assigned:
Status: No Feedback Package: Scripting Engine problem
PHP Version: 4.1.0 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: adam at iewebs dot com
New email:
PHP Version: OS:


 [2001-07-17 08:20 UTC] adam at iewebs dot com
Not sure if this is a bug or a feature, or what the correct result should be, but...

Related to bug #6636, require_once() and include_once() used on a soft link will result in the __FILE__ constant containing only the filename of the link, whereas include() and require() will result in __FILE__ containing the full path and filename of the linked file.

ln -s /path/to/file.php /path/to/link.php


// returns 'link.php'
echo __FILE__;


// returns '/path/to/file.php'
echo __FILE__;


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2001-12-12 07:02 UTC]
On my linux with 4.1.0, __FILE__ has always actual /path/to/file. (i.e. not  pathname of sym link, but pathname linked to) It does not ommit path, though.

I think __FILE__ should have pathname for sym link instead of pathname  linked to...

Is this correct behavior? Anyone?

 [2001-12-12 08:21 UTC]
PHP Version update
 [2001-12-14 14:43 UTC]
I think __FILE__ is better to set filename that is requested.
Status = Analyzed
 [2002-06-18 06:27 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Mar 31 11:03:53 2023 UTC