Article
Migrating from PHP 8.4 to PHP 8.5
PHP 8.5 upgrade notes based on the official migration85 incompatible changes: Opcache built-in, cast warnings, PDO fetch semantics, and more.
PHP 8.5 is in active support until 2027-12-31 (verified 2026-08-09). Use the official documents as the checklist source of truth: migration85 and incompatible changes.
Opcache is always built-in
Opcache is always compiled into the PHP binary and always loaded. Configure flags that produced opcache.so are gone. INI lines like zend_extension=opcache.so emit warnings—remove them and rely on opcache.enable / opcache.enable_cli.
; LEGACY packaging assumption
; zend_extension=opcache.so
; MODERN
opcache.enable=1
opcache.enable_cli=0
Cast and destructuring warnings
Casting floats (or float-like strings) to int when they cannot be represented emits warnings; casting NAN warns. Destructuring non-array values (other than null) with []/list() warns. Turn warnings into CI failures before cutover.
PDO fetch / constructor argument semantics
Constructor arguments used with PDO::FETCH_CLASS now follow normal call_user_func_array semantics (named arguments via string keys; by-ref wrapping changes). Calling setFetchMode() during an active fetch can throw. Retest custom hydrators.
Other notable incompatible changes
class_alias()can no longer use"array"or"callable"as alias names- Loose comparisons of previously “uncomparable” internal objects to booleans were consolidated to follow
(bool)$object disable_classesINI setting removed- mysqli: constructing an already-constructed object throws
setlocale()no longer accepts integer0for locales (TypeError)- Session keys containing
|warn on write
# TRANSITIONAL — fail CI on new 8.5 warnings
error_reporting = E_ALL
display_errors = Off
# capture logs in staging and triage before production
Validate with compatibility checker and full automated suites. Return to the migration center for sequencing across earlier minors.
Related scanners: PHP Version Compatibility Checker · PHP Deprecated Checker.
Related reading
- Composer Modernization Center Add Composer to legacy PHP projects, migrate includes to autoloading, set platform constraints, and replace a…
- PHP 5 to Modern PHP: Complete Incremental Migration Guide A deep, production-minded path from PHP 5.x codebases to supported PHP 8.x: removed extensions, charset, PDO,…
- PHP Security Modernization for Legacy Applications Upgrade inherited PHP security practices: prepared statements, password hashing, sessions, CSRF, XSS escaping…
- PHP 7 to PHP 8 Migration Guide Deep guide to PHP 8.0 breaking changes that matter for PHP 7 applications, with upgrade tactics through suppo…
- Inheriting a Legacy PHP Application A first-30-days playbook for developers handed an unfamiliar PHP codebase: runtime truth, risk triage, and sa…