|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2000-09-16 16:59 UTC] stas@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 18 20:00:01 2025 UTC |
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__.