It's functionality is so strong that I worry about its stability and performance.
What do you think?
UPDATE
What I'm doing is this:
$old_dir = getcwd();
chdir( dirname($included_file) );
include ( $included_file );
chdir( $old_dir );
Essentially it just does include ( $included_file );
,but inside that $included_file
it can't find 3.php
which is in the same directory as itself is in,so I manually set the cwd and it works.But it would be nice if I find the reason why it can't find.As for why debug_backtrace
is needed,it's because 3.php
is included by another func
,since the relative path doesn't work,it has to use debug_backtrace
to get the including file path,finally using the absolute path as mentioned below.
It's not easy to reproduce,as the above code is in the context of a method,and much more..If no one else has met this kinda problem I'd like to just stop here,anyway,the cost is just the 3 extra lines,not a big deal.
call(__FILE__);
– Routinize__FILE__
returns the file where the function is defined,not called. – Freehandedcall(__FILE__);
is the function call not the definition. The declaration would befunction call($path) ....
– Routinize{}
) ofcall()
,not by passing parameters. – Freehandedchdir()
to change to the same directory,to fix the problem that sometimes it won't find even though it's in the same directory,refer to it to understand the whole picture:#2438655 – Freehanded