ID: 31856 Updated by: [EMAIL PROTECTED] Reported By: ftpub at compuserve dot com -Status: Open +Status: Bogus Bug Type: *Directory/Filesystem functions Operating System: Win98 SE PHP Version: Irrelevant New Comment:
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php . Previous Comments: ------------------------------------------------------------------------ [2005-02-05 21:45:24] ftpub at compuserve dot com Description: ------------ All code is in the reproduce section. First, I create a php file with the "inc" extension on my server root (http://localhost/www) and call it "myinclude.inc". Next, I create a regular php file (in the same location) and call it "myscript.php". I run myscript.php from my browser and I get the following: ------------------------------ in the include YAY! ------------------------------ It works. NOW: THE PROBLEM I rename "myinclude.inc" to "myinclude.php". I change line 2 of "myscript.php" accordingly. I again run "myscript.php" from my browser and I get the following: ---------------------- in the include NAY! ---------------------- Obviously, require() and include() do not make the "myvar" variable persist. Also, when I declare functions in an included file which HAS THE "PHP" EXTENSION, the function cannot be called. However, as shown above, if I use the "INC" or any other extension, everything works. ANOTHER ODDITY Since the two files "myinclude.php" and "myscript.php" are both in the same directory I tried not using the "http://localhost/www" part in line 2 of "myscript.php". IT WORKS. Why? Please advise. Thank you. Other Information: PHP Version = 4.3.2 Apache Version = 2.0.46 Reproduce code: --------------- ---myinclude.inc-------------- 1: <?php 2: $myvar = 2; 3: print "in the include\n"; 4: ?> ------------------------------ ---myscript.php--------------- 1: <?php 2: require("http://localhost/www/myinclude.inc"); 3: if ($myvar == 2) print "YAY!"; 4: else print "NAY!"; 5: ?> ------------------------------ Expected result: ---------------- PLEASE SEE DESCRIPTION --------- in the include YAY! --------- if i rename "myinclude.inc" to "myinclude.php" and change "myscript.php" accordingly: --------- in the include NAY! --------- Actual result: -------------- PLEASE SEE DESCRIPTION ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=31856&edit=1
