PHP 4.0 Bug #6636: __FILE__ is destroyed after include()

From: Date: Fri, 08 Sep 2000 19:29:11 +0000
Subject: PHP 4.0 Bug #6636: __FILE__ is destroyed after include()
Groups: php.dev 
Request: Send a blank email to php-dev+get-32718@lists.php.net to get a copy of this message
From: leon@leonatkinson.com Operating system: Linux PHP version: 4.0.2 PHP Bug Type: Scripting Engine problem Bug description: __FILE__ is destroyed after include() 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__.

« previous php.dev (#32718) next »