Bugfix Issue 1536 LegacyDeepLink Stubs 404 Redirect - sebiboga/testlink-upgraded GitHub Wiki

Issue 1536 — reqSpecView.php/archiveData.php: legacy deep-link 404 redirect + 7x E_WARNING removed

Issue: #1536 Branch: fix/issue-1536 Status: VERIFIED-FIXED

Symptom

Two legacy controllers reachable by direct deep link each used to render the old dashio smarty stack whose templates read four kernel-level props ($gui->tproject_id, $gui->tplan_id, $gui->tprojOpt->testPriorityEnabled, $gui->tprojOpt->automationEnabled) that the modern initUserEnv() no longer populates — 6-7 E_WARNING entries in the Event Viewer on every view:

  • lib/requirements/reqSpecView.php?req_spec_id=<id>
  • lib/testcases/archiveData.php?edit=testcase&id=<id>

Two-part story

Part 1 — the stub (commit 36783cb57): both controllers became 302 redirect stubs to their modern twins. This killed the E_WARNING family (no legacy template is ever compiled on this path — events table clean).

Part 2 — the regression the stub introduced (this fix): the Location header used a relative target (gui/templates/...), which the browser resolves against the current directory:

  • /lib/requirements/gui/templates/requirements/reqSpecView.html → 404
  • /lib/testcases/gui/templates/testcases/tcEdit.html → 404

So a deep link landed on a PHP-built-in-server 404 page instead of the modern screen. Root cause per RFC 7231: a non-absolute Location is resolved relative to the requesting URL. The modern screens' own JS uses root-relative URLs (e.g. reqSpecView.html:315), so the stubs must too.

Fix

One-character-prefix change in each stub — Location: /gui/templates/... (root-relative instead of relative).

Regression matrix (all executed, live)

# Case Result
1 curl -L reqSpecView.php?req_spec_id=2&tproject_id=1 302 → 200, final /gui/templates/requirements/reqSpecView.html
2 curl -L archiveData.php?edit=testcase&id=4&tproject_id=1 302 → 200, final /gui/templates/testcases/tcEdit.html
3 Browser navigation of both deep links modern screens render, no 404 page
4 Direct root-relative twin hits 200
5 events table after all hits zero new Error/Warning
6 grep for relative Location: gui/templates no occurrences
7 Syntax gates php -l clean

Screenshots

Before fix: deep link → 404.

reqSpecView deep link before fix

archiveData deep link before fix

After fix: deep link lands on the modern Requirement Specification Viewer and Test Case Editor.

reqSpecView deep link after fix

archiveData deep link after fix