-
Lychee versionv7.5.2 Did you check the latest Lychee version?Yes, I did Which PHP version are you using?PHP 8.5 Detailed description of the problemI am happy to try and fix this issue and have provided 3 options for fixing (see below). Option 1 looks to be the easiest and least invasive but the other options maybe 'more correct' and possibly above my pay grade. Running php artisan lychee:fix-tree on a database with wrong parents fails before it can repair anything: Tree statistics In HasAttributes.php line 515: Steps to reproduce:
Root cause: Three things combine to cause this:
Note: if fix-tree reports zero errors the bug is not triggered, because fixTree() exits before the save phase. Workaround: docker exec lychee-api sh -c 'cd /app && php -r " Suggested fixes: Option 1 — Fix FixTree.php (minimal, targeted) Disable strict mode for the duration of the fixTree() call only: Option 2 — Fix AppServiceProvider.php (correct long-term) Only enable strict mode outside production, as Laravel recommends: // After Option 3 — Fix ForwardsToParentImplementation (most correct, most complex) Ensure base_class (and therefore cover_id) is always eager-loaded whenever an Album model is fetched. This would require ensuring all necessary attributes are present when fixTree() loads models — but since Steps to reproduce the issue● Step 1 — Insert a test album with _lft=0, _rgt=0: docker exec test-lychee_db-1 mysql -u lychee -plychee lychee -e " INSERT INTO albums (id, parent_id, _lft, _rgt) Verify the bad row is there: docker exec test-lychee_db-1 mysql -u lychee -plychee lychee -e " Step 2 — Run fix-tree and observe the crash: docker exec test-lychee_api-1 php artisan lychee:fix-tree Expected output: In HasAttributes.php line 515: Step 3 — Clean up the test album afterward: docker exec test-lychee_db-1 mysql -u lychee -plychee lychee -e " Diagnostics [REQUIRED]docker exec test-lychee_api-1 php artisan lychee:diagnostics Smart DiagnosticsInfo: Hash: ee4d8b1e9aa8b665—b679cad74627845b System InformationLychee Version (release): 7.5.2 Docker: lycheeorg-frankenphp System: Linux exec() Available: yes Config Informationversion: 070502 Browser & System [REQUIRED]No response Please confirm (incomplete submissions will not be addressed)
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
|
Thank you, I will double check. None of the solution are good actually. :D This is too risky. This is absolutely NOT the way to go as your dev environment will be breaking but prod will be broken without warning.
This is kind of the idea to go for yes. But I am not sure that way exactly. |
Beta Was this translation helpful? Give feedback.
Fixed in
edge.