- tag-search: add minTags/required params, counter shows red if < 3, accent if ≥ 3 - form.php: pass minTags=3 for partage mode keywords - checkbox-list: support labelHtml for raw HTML label with targetable asterisk span - language-autre-fragment: OOB swap updates #languages-required-asterisk when autre pills change - language-search: client-side update #languages-required-asterisk on pill add/remove - contenus.php: replace 3 form+submit-button fieldsets with HTMX auto-save checkboxes - settings.php: detect HX-Request header, return OOB CSRF token updates, skip redirect
4.2 KiB
Current Issues — XAMXAM (2026-05-10)
1. FK constraint violation on thesis save (create + edit)
Symptom: ⚠ SQLSTATE[23000]: Integrity constraint violation: 19 FOREIGN KEY constraint failed
Triggers:
- Editing an imported CSV thesis, changing access type to Interdit, save
- Opening any imported thesis edit form and saving without changes
- Saving the add form with empty fields — form below "Cadre académique" disappears (PHP dies mid-render)
Root cause found so far: Database::createThesis() at line ~1860 was doing (int)$data['orientation_id'] which converts SQL null → PHP null → (int)null = 0. Since no row with ID 0 exists in orientations, this triggers FK violation. Fixed in commit 55088c94 by using $v ? (int)$v : null pattern.
Still happening after fix — suggests another code path has same issue, or the fix wasn't complete. The updateThesis path was already safe (uses ?: null), but the error persists.
Debugging added:
[DB:updateThesis]log line with all FK values before query (commit55088c94)[ThesisEdit] Step 1-6 OKstep-level logging (commit8734d964)ErrorHandler::log()with full trace on catch (commit03ad73f3)
Dev server output: No error_log visible in dev mode — PHP built-in server sends errors to stderr which may not be captured.
Next steps:
- Enable
display_errors=1in dev mode so FK errors render in browser - Check if
setThesisFormats,setThesisLanguages,setThesisTagspaths also have(int)null→0issues - Check
formulaire.phpaction file — does it also usecreateThesis?
2. Dev server debugging output
Symptom: No error output visible in browser when PHP crashes.
Current config (bootstrap.php):
- Dev mode (cli-server):
display_errors=1,error_reporting=E_ALL - Production:
display_errors=0,log_errors=1
But: the admin action files override this:
formulaire.phpline 5-7:ini_set('display_errors', 0); ini_set('log_errors', 1);edit.phpaction: no override (uses bootstrap defaults)
Action needed: Don't suppress display_errors in dev mode. Check php_sapi_name() before overriding.
3. Console warnings
Layout was forced before the page was fully loaded. node.js:416:1
[file-upload-queue] XamxamInitFileUploads called (twice)
file-upload-queue.jscalled twice — the script might be included twice (checkadd.phptemplate + theform.phppartial)
4. Tags: lowercase + dedup + CSV import
Status: Implemented across all paths:
- Frontend JS:
normalizeTag()withreplace(/\s+/g, ' '), lowercase - Server fragment:
preg_replace('/\s+/', ' ', strtolower(...)) - Both controllers:
fn(string $t) => strtolower(trim(preg_replace('/\s+/', ' ', $t))) - CSV import: same normalization (commit
8734d964) - Minimum 3 tags enforced (commit
8734d964)
5. ErrorHandler coverage
Status: Applied to 12 admin action files + 6 public controllers + 2 form controllers + partage entry point (commit 03ad73f3). 77 unit test assertions.
Relevant commits (most recent first)
55088c94 Fix FK violation: (int)null → 0 in createThesis
27378b42 ErrorHandler tests: 77 assertions
4d9296fd ErrorHandler: precise FK field extraction from SQLite
03ad73f3 ErrorHandler: shared logging across all actions/controllers
6b6c62d1 Error logging: step-by-step transaction tracing
8734d964 Mots-clés: collapse spaces, minimum 3 keywords
dfe1186b Mots-clés: lowercase, dedup, keyboard nav, absolute dropdown
8d04d4ba Mots-clés: lowercase enforcement, deduplication, absolute dropdown
7fe53f8c Mots-clés: interactive HTMX tag search
dd110cc5 Admin mobile block: fix inline style beating media query
Key files to review
app/src/Database.php—createThesis()line ~1830,updateThesis()line ~1751,setThesisFormats/Languages/Tagsapp/src/Controllers/ThesisCreateController.php—submit()line ~146,validateAndSanitise()line ~312app/src/Controllers/ThesisEditController.php—save()line ~158app/public/admin/actions/formulaire.php— calls$ctrl->submit()(create path)app/public/admin/actions/edit.php— calls$ctrl->save()(edit path)app/public/admin/index.php— CSV import at line ~220