From 80b7fddea43f79f99bc9cb14c2883a5dbce4b137 Mon Sep 17 00:00:00 2001 From: Pontoporeia Date: Wed, 29 Apr 2026 21:54:18 +0200 Subject: [PATCH] fix: partials must not unset caller-owned $formData MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fieldset-academic.php, fieldset-metadata.php and fieldset-licence-explanation.php were each calling unset($formData) (or wrong variable) in their cleanup block, destroying the variable in the parent renderShareLinkForm() scope. This caused an Undefined variable / TypeError on old($formData, ...) for any field rendered after those partials (e.g. confirmation_email at line 328). Fix: remove $formData from the unset() calls; fieldset-licence-explanation.php was also unsetting the wrong name — corrected to unset($n) which is the variable it actually declares. --- TODO.md | 2 ++ app/templates/partials/form/fieldset-academic.php | 2 +- app/templates/partials/form/fieldset-licence-explanation.php | 2 +- app/templates/partials/form/fieldset-metadata.php | 2 +- 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/TODO.md b/TODO.md index 3265c4c..8dd6bb3 100644 --- a/TODO.md +++ b/TODO.md @@ -12,6 +12,8 @@ ## Bug fixes - [x] Fix `$enabledAccessTypes` undefined / `array_map()` TypeError on edit page — controller was fetching `getAccessTypes()` instead of `getEnabledFormAccessTypes()` and returning it under the wrong key +- [x] Fix fatal TypeError: `old()` called with wrong arity in `jury-fieldset.php` partial under partage context — removed `?: null` coercions so `$juryPresident`/`$juryPromoteur` are `''` not `null`, keeping `$addMode` false +- [x] Fix `$formData` destroyed by included partials (`fieldset-academic.php`, `fieldset-metadata.php`, `fieldset-licence-explanation.php` were incorrectly unsetting `$formData`/wrong variable in caller scope) ## Form help blocks — sortable admin UI diff --git a/app/templates/partials/form/fieldset-academic.php b/app/templates/partials/form/fieldset-academic.php index 44d7f87..62935fb 100644 --- a/app/templates/partials/form/fieldset-academic.php +++ b/app/templates/partials/form/fieldset-academic.php @@ -59,4 +59,4 @@ $formData = $formData ?? []; ?>