set_include_path then using a path relative to the include path fools hphp
FYI It stripped the 2 underscores before and after FILE -- FILE
set_include_path seems to fail in the simplest cases. With either relative or absolute paths.
ini_set('include_path',...) also fails.
From HPHP's code...
Variant ei_set_include_path(Eval::VariableEnvironment &env, const Eval::FunctionCallExpression *caller) {
...
return (x_set_include_path(a0));
inline String x_set_include_path(CStrRef new_include_path) {
FUNCTION_INJECTION_BUILTIN(set_include_path);
return f_set_include_path(new_include_path);
}
String f_set_include_path(CStrRef new_include_path) {
return "";
}
Looks like a lot of plumbing was written, but it wasn't implemented.
FYI this stops Mantis bug tracker working, as it is heavily architected to rely on include paths.
Even worse --include-path="/usr/share/php" or whatever directory has no impact. Guess I should open another bug
This currently also breaks Magento.
I think we fixed this today in cbb6275467cf024435c041c480b635e631fdd610
I tried this with the following PHP files and it sadly does not seem to work. I tried it with HPHPi and compiled. a,b are under t1 and b,c are under t2 and they each echo FILE
<?php
var_dump(get_include_path());
ini_set('include_path', get_include_path().PATH_SEPARATOR.'t1');
var_dump(get_include_path());
set_include_path(get_include_path().PATH_SEPARATOR.'t2');
var_dump(get_include_path());
include 'a.php';
include 'b.php';
include 'c.php';
set_include_path('t2');
include 'a.php';
include 'b.php';
include 'c.php';
the output with apache:
string(32) ".:/usr/share/php:/usr/share/pear"
string(35) ".:/usr/share/php:/usr/share/pear:t1"
string(38) ".:/usr/share/php:/usr/share/pear:t1:t2"
/home/arlo/public_html/test/t1/a.php
/home/arlo/public_html/test/t1/b.php
/home/arlo/public_html/test/t2/c.php
/home/arlo/public_html/test/t2/b.php
/home/arlo/public_html/test/t2/c.php
the output with HPHPi
string(0) ""
string(0) ""
string(0) ""