Skip to content

Bugfix Issue 1513 RequirementCopyVersion FreezeLink EWarning

github-actions[bot] edited this page Sep 15, 2026 · 1 revision

Bugfix — Issue #1513: reqedit create-new-version — 2x E_WARNING Undefined property stdClass::$freezeLinkOnNewReqVersion in requirement_mgr::copy_version

Problem

Every requirement_mgr::copy_version() invocation (any create_new_version() path — legacy req edit controllers, the modern api/reqimport BFF actionOnHit=create_new_version, bulk createFromXML/createFromMap) logs a PHP 8 E_WARNING "Undefined property: stdClass::$freezeLinkOnNewReqVersion" into the events table (Event Viewer, log_level=2):

E_WARNING
Undefined property: stdClass::$freezeLinkOnNewReqVersion - in .../lib/functions/requirement_mgr.class.php - Line 2477

A second masked warning (requirement_mgr::$debugMsg, line 2498) fires as soon as the freeze option is honoured.

Reproduced 2026-09-15 on PHP 8 / MariaDB (fresh fixture: project 1000/PROJ option_reqs=1, req_spec 1001, requirement 1002/REQ-001 + versions) via a CLI harness booting the app like a BFF and calling requirement_mgr::create_new_version(1002) — events row as above. The modern reqEdit.html Create New Version button goes through api/reqedit/index.php → create_version() (bare INSERT, not copy_version()), so the bug surface is the copy_version() path itself.

Root Cause

  1. config.inc.php:1415 defines the option as freezeLinkOnNewREQVersion (REQ uppercase).
  2. copy_version() (requirements requirement_mgr.class.php:2477-2478) read freezeLinkOnNewReqVersion — wrong casing — off the stdClass (line 66). PHP 8 undefined-property access → E_WARNING.
  3. lib/functions/logger.class.php:1483 + watchPHPErrors → logWarningEvent writes the E_WARNING row into events (log_level=2).
  4. The null value also defeated line 2487 if($freezeLinkOnNewReqVersion) → updateTCVLinkStatus(...) (link-freeze on new REQ version) silently never ran.
  5. Fixing the mask exposed the long-dormant closeOpenTCVersionOnOpenLinks() $this->debugMsg typo (line 2498, unchanged since legacy cb365cd5e, 1.9.18) — the $freezeLinkedTCases null-guard had kept that branch unreachable.

Fix

lib/functions/requirement_mgr.class.php (minimal, no signature change):

  1. copy_version() — read the real key: $freezeLinkOnNewREQVersion = $reqTCLinksCfg->freezeLinkOnNewREQVersion; (2477/2478/2487).
  2. closeOpenTCVersionOnOpenLinks() — local $debugMsg = 'Class:...' (line 2498), keeping the /* ... */ SQL-comment wrapper in the UPDATE (dropping it produces SQL 1064, caught during verification).

Both warnings are on the same new-version user action, so both must be gone to meet the issue's Expected state ("No Error/Warning event entries").

Verification (regression suite 8/8 PASS)

  • CLI create_new_version() runs → events gains 0 rows.
  • With an OPEN req_coverage link on the source version → link flips link_status 1 → 4 (LINK_TC_REQ_CLOSED_BY_NEW_REQVERSION), is_active → 0 (option finally honoured).
  • Browser reqEdit.html → Create New Version → version OK, events 0, console clean.
  • php -l clean; grep freezeLinkOnNewReqVersion → 0 hits.

Requirement Editor after the fix — Create New Version clean

Files changed

  • lib/functions/requirement_mgr.class.php (5 lines)
  • tmp/TLU_Test_Cases.md (regression suite #1513)
  • docs/Bugfix-Issue-1513-RequirementCopyVersion-FreezeLink-EWarning.md + screenshot
  • CHANGELOG (key bugfix line)

Clone this wiki locally