PHP 4.0 Bug #6636 Updated: __FILE__ is destroyed after include()
| From: | Bug Database | Date: | Sat, 16 Sep 2000 20:59:05 +0000 |
| Subject: | PHP 4.0 Bug #6636 Updated: __FILE__ is destroyed after include() | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-33353@lists.php.net to get a copy of this message | ||
ID: 6636
Updated by: stas
Reported By: leon@leonatkinson.com
Status: Closed
Bug Type: Scripting Engine problem
Assigned To:
Comments:
fixed in CVS.
Previous Comments:
---------------------------------------------------------------------------
[2000-09-08 15:29:11] leon@leonatkinson.com
I noticed that in 4.0.2 that __FILE__ loses it's value after a file is included. This is
having an impact on a lot of my legacy code that was written before include_once() was added because
I use __FILE__ to make a unique variable to mark that a file has been included already.
Here's some code that demonstrates the problem:
<?
$x++;
if($x > 10)
{
return(FALSE);
}
print("$x: " . __FILE__ . "<br>n");
include("testinclude.php");
?>
It's producing:
1: /usr/local/apache/htdocs/testinclude.php
2:
3:
4:
5:
6:
7:
8:
9:
10:
Related to this is that if I switch to include_once, __FILE__ now holds the value of just
"testinclude.php".
It loses it's path.
I'm not seeing this behavior in 4.0.1pl2. I apologize for not having the time to dig into the
source right now to figure out what's going on. Hopefully someone remembers making the change
that broke __FILE__.
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=6636