File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
packages/php-wasm/xdebug-bridge/src Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 1
1
import type { PHP } from '@php-wasm/universal' ;
2
- import { readdirSync , readFileSync , statSync } from 'fs' ;
2
+ import { readdirSync , readFileSync , lstatSync } from 'fs' ;
3
3
import { join } from 'path' ;
4
4
import { CDPServer } from './cdp/cdp-server' ;
5
5
import { XdebugCDPBridge } from './cdp/xdebug-cdp-bridge' ;
@@ -46,7 +46,8 @@ export async function startBridge(config: StartBridgeConfig) {
46
46
const list = readdirSync ( dir ) ;
47
47
for ( const file of list ) {
48
48
const filePath = join ( dir , file ) ;
49
- const stat = statSync ( filePath ) ;
49
+ // lstat avoids crashes when encountering symlinks
50
+ const stat = lstatSync ( filePath ) ;
50
51
if ( stat && stat . isDirectory ( ) ) {
51
52
results . push ( ...getPhpFiles ( filePath ) ) ;
52
53
} else if ( file . endsWith ( '.php' ) ) {
You can’t perform that action at this time.
0 commit comments