Skip to content

Fix #45: PHAR unable to access local endpoints#46

Merged
keyamasabaya merged 24 commits into
mainfrom
fix/issue45
Mar 1, 2026
Merged

Fix #45: PHAR unable to access local endpoints#46
keyamasabaya merged 24 commits into
mainfrom
fix/issue45

Conversation

@keyamasabaya

Copy link
Copy Markdown
Owner

Fixes issue #45

Problem

PHAR build (v2.28) unable to access local endpoints — file list polling, preview, history, and import all broken. Also affects traditional installation for some actions.

Root Cause Analysis

5 bugs identified, mostly routing/URL regressions since v2.24:

  1. Missing route in whitelistsse_files registered in Router but absent from Request::determineAction() validation
  2. Delete form mismatch — Template sends filename field, controller reads delete parameter
  3. PHAR URL resolutiongetScriptUri() only strips /index.php, not .phar entry points
  4. Broken home link in PHARhref="./" resolves to parent directory instead of PHAR file
  5. SVG references in PHARhref="assets/icons.svg#..." fails since icons are inlined in PHAR mode

Changes

  • src/Core/Request.php — Add sse_files to validActions, fix getScriptUri() regex for .phar
  • templates/home.php — Replace broken POST delete form with GET link matching controller
  • templates/layout_phar.php — Use $scriptName for home link
  • src/Core/View.php — Add iconRef() helper for PHAR-compatible SVG references

Testing

  • PHAR build: preview, history, file list, delete, import
  • Traditional install: same endpoints
  • SSE streaming in both modes

keyamasabaya and others added 24 commits January 14, 2026 18:16
Sync the action whitelist with Application::setupRoutes() so that
?action=sse_files requests are no longer silently dropped to 'home'.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ntroller

The form sent 'filename' but BigDumpController::delete() reads 'delete'.
Replace with <a href="?delete=FILENAME"> to match both the controller
and the pattern already used in filepolling.js.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The regex now matches both /index.php and /anything.phar so that
PHAR-mode requests get a clean base URI for link generation.

Adds RequestTest.php with 8 tests covering index.php, .phar,
nested paths, and non-matching paths.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
$scriptUri resolves to the parent directory (/tools) which breaks
navigation in PHAR mode. $scriptName points to the PHAR file itself
(bigdump.phar), giving a correct home link.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
In PHAR mode icons are inlined in the DOM, so <use> elements must
reference fragments (#id) instead of external files (assets/icons2.svg#id).

- Add iconRef(string $id) to View.php
- Replace all 15 hardcoded icon paths in home.php with the helper

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sync the action whitelist with Application::setupRoutes() so that
?action=sse_files requests are no longer silently dropped to 'home'.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ntroller

The form sent 'filename' but BigDumpController::delete() reads 'delete'.
Replace with <a href="?delete=FILENAME"> to match both the controller
and the pattern already used in filepolling.js.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The regex now matches both /index.php and /anything.phar so that
PHAR-mode requests get a clean base URI for link generation.

Adds RequestTest.php with 8 tests covering index.php, .phar,
nested paths, and non-matching paths.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
$scriptUri resolves to the parent directory (/tools) which breaks
navigation in PHAR mode. $scriptName points to the PHAR file itself
(bigdump.phar), giving a correct home link.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
In PHAR mode icons are inlined in the DOM, so <use> elements must
reference fragments (#id) instead of external files (assets/icons2.svg#id).

- Add iconRef(string $id) to View.php
- Replace all 15 hardcoded icon paths in home.php with the helper

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@keyamasabaya
keyamasabaya merged commit 746a751 into main Mar 1, 2026
1 check passed
@keyamasabaya
keyamasabaya deleted the fix/issue45 branch March 1, 2026 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant