Fix 500 on fleet movement during moon destruction missions#1492
Fix 500 on fleet movement during moon destruction missions#1492tiweb442 wants to merge 2 commits into
Conversation
MoonDestructionMission was missing the static friendlyStatus property, causing getFriendlyStatus() to throw when FleetController rendered mission type 9 on /fleet/movement. Fixes lanedirt#1446 Co-authored-by: Cursor <cursoragent@cursor.com>
Related PRs from tiweb442 (same deployment / review batch)
Context: Merge order: Independent of #1491–#1494 — no conflicts expected. |
|
Ready for maintainer review — preview is live and mergeable with @lanedirt @jackbayliss Could you review when you have a moment? Fork PRs may also need “Approve and run workflows” so Pint / PHPStan / Docker tests run (currently only PR Preview has completed). Test on preview: https://pr-1492.preview.ogamex.dev |
|
Hi @tiweb442, thank you for your contribution(s). Please check out CONTRIBUTING.md, there is loads of (necessary) information there that should be taken into consideration when opening a PR. Be advised that there is currently a wait time attached to getting PRs reviewed. The project's development speed has slowed down somewhat in the last few weeks and it may take some time until this gets a proper review. |
|
ok thx for the head up |
The class defaults to transport (3), so the regression test was dispatching the wrong mission and never asserted Moon Destruction. Co-authored-by: Cursor <cursoragent@cursor.com>
|
CI fix pushed: the new fleet-movement regression test was still using the class default |
Preview deploymentPreview environment for this PR is ready for functional testing. Use one of the test accounts below to log in.
Test accounts (click to expand)
This preview will be automatically destroyed when the PR is closed. |
Geda173
left a comment
There was a problem hiding this comment.
Verified the fix by removing the added property and confirming both new tests fail with the exact must not be accessed before initialization error, then pass again once restored. Good regression coverage.
Summary
$friendlyStatus = HostiletoMoonDestructionMission/fleet/movementcallsGameMission::getFriendlyStatus()for every active mission; type 9 crashed with an uninitialized static property (PHP 8.2+)determineFriendly()insteadFixes #1446
Test plan
./vendor/bin/phpunit tests/Unit/MoonDestructionMissionTest.php --filter testFriendlyStatusIsHostile./vendor/bin/phpunit tests/Feature/FleetMovementTest.php --filter testFleetMovementShowsMoonDestructionMission/fleet/movementreturns 200 instead of 500Made with Cursor