File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed
packages/php-wasm/node/src/lib Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -92,24 +92,24 @@ export async function loadNodeRuntime(
92
92
*/
93
93
if ( options ?. followSymlinks === true ) {
94
94
/**
95
- * PHP might call `lookupPath` with ` follow: false` .
96
- * When this happens Emscripten will not follow the symlink when it's the final path component.
97
- * This happens for example during a is_dir check or lstat .
95
+ * By default, Emscripten will not follow symlinks when it's the final path component .
96
+ * This behavior can cause issues in PHP-wasm when the caller requires the symlink to be followed,
97
+ * but the PHP-wasm call to lookupPath didn't explicitly set follow to true .
98
98
*
99
- * To work around this, we override the `lookupPath` function to always follow the symlink.
99
+ * To ensure symlinks are followed by default when symlink following is enabled in PHP-wasm,
100
+ * we override the `lookupPath` function and set follow to true.
100
101
*
101
- * TODO:
102
- * - Understand why we must override follow: false when it's explicitly required by the caller.
103
- * - Find a way to set follow: true as the default behavior, but allow the caller to override it.
102
+ * PHP and Emscripten functions can still override the default behavior
103
+ * by setting follow to false which is required for function calls like lstat.
104
104
*/
105
105
const lookupPath = phpRuntime . FS . lookupPath ;
106
106
phpRuntime . FS . lookupPath = (
107
107
path : string ,
108
108
options : any = { }
109
109
) => {
110
110
return lookupPath ( path , {
111
+ follow : true ,
111
112
...options ,
112
- follow : true , // TODO: This should be overridable by options.follow.
113
113
} ) ;
114
114
} ;
115
115
You can’t perform that action at this time.
0 commit comments