Created
July 1, 2013 18:11
-
-
Save samartioli/5903171 to your computer and use it in GitHub Desktop.
fopen does not take include_path into consideration as of HipHop VM v2.1.0-dev.
fopen's 3rd param when set to true should take all include paths into consideration when trying to open the file. http://php.net/manual/en/function.fopen.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A basic folder structure to replicate this is as follows: | |
./fopen.php | |
./someIncludeFolder/ | |
./someIncludeFolder/someIncludedFile.php |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$filename = 'someIncludedFile.php'; | |
echo "Include path is: " . get_include_path() . "\n"; | |
set_include_path( | |
implode( | |
PATH_SEPARATOR, | |
array( | |
'./someIncludeFolder', | |
get_include_path() | |
) | |
) | |
); | |
echo "Include path is now: " . get_include_path() . "\n"; | |
if (!$fh = fopen($filename, 'r', true)) { | |
echo "### INFO: Unable to open someIncludedFile.php\n"; | |
} else { | |
echo "### INFO: Opened someIncludedFile.php successfully\n"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ php fopen.php | |
Include path is: .:/usr/share/php:/usr/share/pear | |
Include path is now: ./someIncludeFolder:.:/usr/share/php:/usr/share/pear | |
### INFO: Opened someIncludedFile.php successfully | |
$ hhvm fopen.php | |
Include path is: ./ | |
Include path is now: ./someIncludeFolder:./ | |
HipHop Warning: No such file or directory in ./fopen.php on line 20 | |
### INFO: Unable to open someIncludedFile.php |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
echo "This is someIncludedFile.php"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment