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_classes INI setting removed
  • mysqli: constructing an already-constructed object throws
  • setlocale() no longer accepts integer 0 for 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