Include(_once) & require(_once) looks for included files in wrong directory, depending on CWD #17
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Aer Information
4c81475afb
Your problem description
When relative path is passed as argument to include alike function, it looks for source file in current directory (.). When first source file is opened, it should change working directory to it. This way, script will behave in the same way, independent on CWD.
Example directory structure:
~/
~/binary
~/binary/psharp
~/test.php
~/a.php
test.php:
a.php:
If our current working directory (CWD) is ~/binary and we call ./psharp ../test.php it will not find a.php. However, if we change directory to ~ and call ./binary/psharp test.php it will work just fine.
IMHO, Aer Interpreter should change CWD to directory containing entry file.
hopefully #16 fix ought to fix it too.
Unfortunately not.
What is more, require_once & include_once stopped working.
Hopefully it does now :)
Yes, functions are working again, however this ticket is not resolved yet.
File inclusion depends on CWD and I believe we have to chdir to realpath of entry file.
This is still not working. In
3ed00e610f
, I have fixed the PH7_VM_CONFIG_IMPORT_PATH mechanism. Actually, we just need to get the absolute path of entry file, then obtain realpath and register it into import path.I will take care.