Skip to content

Static files run as PHP when path includes directory like <some-dir>.php/ #1365

Closed
@brandonpayton

Description

@brandonpayton

If a static file is under a directory tree where an ancestor directory has a name ending in ".php" (e.g., /root/some.php/assets/photo.jpeg), Playground will say that the file seems like a PHP file:

function seemsLikeAPHPFile(path: string) {
return path.endsWith('.php') || path.includes('.php/');
}

And IIUC Playground will try to run such non-PHP files as PHP:

if (!seemsLikeAPHPRequestHandlerPath(fsPath)) {
return this.#serveStaticFile(
await this.processManager.getPrimaryPhp(),
fsPath
);
}
return this.#spawnPHPAndDispatchRequest(request, requestedUrl);

Discovered when investigating #1332.

Metadata

Metadata

Assignees

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions