LLMs Asked to Modernize Legacy PHP Break More Working Files Than They Fix
When Modernization Breaks Working Code: A Study of LLMs on Legacy PHP
Five LLMs were each asked to modernize 100 WordPress 4.0 PHP files to PHP 8.3 while preserving behavior, with no project context or execution feedback. Evaluated against 630 hidden behavioral checks, the results are sobering: 83 untouched files already pass everything, but the best model leaves only 59. Each model breaks 32-51 working files while repairing at most 10; the rule-based tool Rector breaks 7 and repairs 6. Most damage is avoidable, often from type declarations PHP itself rejects.
Only 37 findings (7 percent) require a change under PHP 8.3, yet in compatible files with no required change, the LLMs break 36-60 percent (Rector: 8 percent).
- plorkyeran
> We study a common intermediate setting: a developer pastes one complete file into a chat assistant [5], which sees the file’s internal structure but not its callers or dependencies. We evaluate the first answer, not an agent’s result after iterating on errors.
Very unsurprising results given this methodology. The agentic approach where models are allowed to iterate on changes is a very big part of what has made LLM coding tools actually useful.
- kgeist
The average age of the explored models is ~1.5 years. They discuss PHP 8.3, which was released in 2023 and has not been actively supported since 2025. Agentic coding isn't used.
I'm not sure what the point is of publishing results on the mid-2025 state of the art in October 2026.
- StevenWaterman
Models:
- Claude Sonnet
- Gemini 2.5 Flash
- Gemini 2.5 Pro
- GPT-5 Codex
- Llama 3.3 70B
It's inconvenient how quickly things are improving, makes potentially-interesting results like this dubiously relevant