Include Bug?
| From: | Steven Walker | Date: | Fri, 06 Jun 2003 16:51:25 +0000 |
| Subject: | Include Bug? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-150519@lists.php.net to get a copy of this message | ||
Hello,
I have found troubling behavior using include() that looks like a bug. When I specify an include file by a full path name versus a relative path, PHP acts as though it has included the file, but variable and constant definitions in the include file are not coming through. My server is running PHP 4.3.1.
Here is an example:
I created a file called 'include.php', with the following contents:
<?
echo "include.php opened <br>"; //should print -only- if included, right?
$testVar = "test succeeded!";
?>
Then I created 'test.php', with the following contents:
<?
$testVar = "not defined"; //include.php should redefine this as 'test succeeded!'
//include("http://www.walkereffects.com/test/include.php"); // full path
include("include.php"); // relative path
echo $testVar;
?>
Using the relative path version of include outputs:
include.php opened
test succeeded!
And using the full path results in:
include.php opened
not defined
This doesn't seem right! Any ideas how I can work around this?
Steven J. Walker
Walker Effects
www.walkereffects.com
steve@walkereffects.com