Skip to content
Guides Web Development Platform

PHP Breaking Changes by Version: 8.2 to 8.3, 8.3 to 8.4, 8.4 to 8.5 and 8.5 to 8.6

Shakewell ·

Upgrading PHP from 8.2 to 8.5 is not one change but three: 8.2 to 8.3, 8.3 to 8.4 and 8.4 to 8.5, with 8.6 now one more hop beyond that. Each hop has its own list of backward-incompatible changes and deprecations on php.net, and most of each list will never touch your code.

This guide picks out the items that tend to affect real applications, with a short “what to search your code for” under each hop. Every item comes from the PHP manual’s migration guides, read on 29 November 2026. If you are on PHP 8.2, our PHP 8.2 end of life guide covers the deadline, and the PHP 8.6 guide covers the newest release.

Which PHP versions are still supported

PHP 8.2 stops receiving security fixes on 31 December 2026, so the question for most teams is no longer whether to move but how far.

Support timeline for PHP 8.2 to 8.6 showing release date, active support end and security support end for each version

Version Released Active support ends Security support ends
8.2 8 December 2022 31 December 2024 31 December 2026
8.3 23 November 2023 31 December 2025 31 December 2027
8.4 21 November 2024 31 December 2026 31 December 2028
8.5 20 November 2025 31 December 2027 31 December 2029
8.6 19 November 2026 31 December 2028 31 December 2030

PHP 8.2 to 8.3 breaking changes

This is usually the lightest hop. Most of the 8.3 deprecation list covers rarely used functions, and the backward-incompatible list is short.

Four hops from PHP 8.2 to 8.6, each with the change that most often needs attention

Negative array indexes. Assigning a negative index $n to an empty array now makes the next index $n+1 instead of 0. Search for arrays that start from a negative key ($a[-5] = ...) and then append with [], including keys built from calculated offsets.

range() is stricter. It now throws a TypeError for object, resource or array boundaries, a ValueError for a step of 0 or infinity, and warns on empty-string or non-numeric string boundaries. Character ranges also change: range('9', 'A') now returns a character list. Search for every range( call that takes user input, characters or a float step.

Date errors are exceptions. The Date extension now throws errors and exceptions from the DateError and DateException hierarchies instead of warnings and generic exceptions. Search for new DateTime(, date_create(, DateInterval and DatePeriod and look at the try/catch around each, and at any code that suppressed or logged the old warnings.

Traits and static properties. Traits now redeclare static properties inherited from the parent class, so each using class gets its own storage. Search for static $ inside trait files if you use traits as shared counters or caches.

Other items worth a look: number_format() no longer ignores a negative decimals value, file() rejects invalid flags such as FILE_APPEND, the opcache.consistency_checks setting was removed (search your php.ini and pool files), and programs near stack overflow may now throw an Error.

Deprecations to log: get_class() and get_parent_class() with no arguments, ++ on non-alphanumeric strings, assert_options() with the assert.* INI settings, ldap_connect() with separate hostname and port, ReflectionProperty::setValue() with one argument, MT_RAND_PHP, and SQLite3::enableExceptions(false).

PHP 8.3 to 8.4 breaking changes

This hop has more items that hit ordinary application code, mainly because of one deprecation that is very common in older codebases.

Implicitly nullable parameters. The manual says a type with a null default should be written as T1|null or ?T1. Code like function save(User $user = null) now logs a deprecation. Search with the regular expression [A-Za-z\\]+ \$[a-z_]+ = null and expect many hits in older code and in vendor packages. Rector can rewrite your own code, but vendor code needs an updated package.

exit() and die() behave like functions. They can be used as callables, respect strict_types and apply normal type coercion; an invalid type throws a TypeError. Search for exit( and die( with non-string, non-int arguments.

E_STRICT is gone. The error level was removed and the constant is deprecated. Search for E_STRICT in php.ini, error_reporting() calls and custom error handlers.

PDO driver attributes must be booleans. For MySQL, PDO::ATTR_AUTOCOMMIT, PDO::ATTR_EMULATE_PREPARES and PDO::MYSQL_ATTR_DIRECT_QUERY are boolean attributes. Search your database config for those names. Also note that in PDO_PGSQL, credentials in the DSN now take priority over the constructor arguments.

Opcache JIT default. opcache.jit changed from tracing to disable, and opcache.jit_buffer_size from 0 to 64M. The manual says this “may affect users who previously enabled JIT through opcache.jit_buffer_size exclusively, without also specifying a JIT mode using opcache.jit”, and tells them to set opcache.jit accordingly. Check your server configuration.

Sessions. Changing session.sid_length, session.sid_bits_per_character, session.use_only_cookies, session.use_trans_sid, session.trans_sid_tags, session.trans_sid_hosts and session.referer_check is deprecated, as is the SID constant and session_set_save_handler() with more than two arguments. Search session_set_save_handler( and ini_set('session..

Smaller breaks. The GMP class is now final, round() throws a ValueError for an invalid mode, and the MySQL wait-timeout error code changed from 2006 to 4031 for MySQL server 8.0.24 and later. The manual also warns that every new function, class, interface, enum or constant may cause a redeclaration Error, so search for polyfills and helpers that share a name with a new built-in.

Other deprecations: trigger_error() with E_USER_ERROR, _ as a class name, lcg_value(), mysqli_ping(), and relying on the default escape argument of fputcsv(), fgetcsv() and str_getcsv(). Pass escape explicitly.

PHP 8.4 to 8.5 breaking changes

Cast names. (boolean), (integer), (double) and (binary) are deprecated; use (bool), (int), (float) and (string). Search with \((boolean|integer|double|binary)\).

null as an array offset. Using null as an array key, or passing it to array_key_exists(), is deprecated; use an empty string. Search for array_key_exists( and for array keys that come from variables that may be null.

Backtick operator. The `command` operator is deprecated. Search for backticks inside PHP code and use shell_exec() deliberately, with escaping.

__sleep() and __wakeup() are soft-deprecated in favour of __serialize() and __unserialize(). Search for both names, especially in models stored in caches or queues.

Opcache is always built in. The --enable-opcache and --disable-opcache configure flags were removed, and loading zend_extension=opcache.so now emits a warning. Remove that line from php.ini or your Dockerfile and keep opcache.enable settings.

PDO and printf. PDO::FETCH_CLASS constructor arguments now follow call_user_func_array() rules, so string keys act as named arguments. The printf family now treats a formatter with no explicit precision as precision 0. The driver-specific constants on PDO, such as PDO::MYSQL_ATTR_SSL_CA, are deprecated in favour of Pdo\Mysql::ATTR_SSL_CA and equivalents, so check your database configuration.

Warnings that were silent before. Destructuring a non-array with [] or list() now emits a warning (null excepted), as does a float that cannot be represented as an int in an explicit or implicit cast. The disable_classes INI setting was removed. Applying #[\Attribute] to an abstract class, enum, interface or trait is now a compile-time error. Traits are bound before the parent class.

Housekeeping deprecations: curl_close(), imagedestroy(), finfo_close() and xml_parser_free() (objects are freed automatically), and $http_response_header in favour of http_get_last_response_headers().

PHP 8.5 to 8.6 breaking changes

PHP 8.6 was released on 19 November 2026. Its main behavioural change is the session defaults: session.use_strict_mode and session.cookie_httponly are now on, and session.cookie_samesite is Lax. We cover that change on its own in our PHP 8.6 session defaults guide.

Beyond sessions, search your code for these:

  • return inside finally is deprecated, because it silently discards exceptions and overrides returned values.
  • Return values from __construct() and __destruct() are deprecated, as are generators there.
  • let and is as class, function or constant names are deprecated, along with _ as a constant name.
  • mb_ereg(), mb_split() and the other mbstring regex functions are deprecated; the manual points to PCRE with the u modifier.
  • is_double(), is_long(), is_integer() and doubleval() are deprecated aliases. spl_object_hash() is deprecated in favour of spl_object_id().
  • trim(), ltrim() and rtrim() now strip form feed (\f) by default.
  • fclose(), file_put_contents() and copy() now return false when flushing or closing fails, so code that ignored their result may now see failures.
  • Many functions throw ValueError for NUL bytes, invalid flags or out-of-range values, including getenv(), putenv(), parse_str(), proc_open() and file functions such as file_exists().
  • preg_grep() returns false on execution errors instead of a partial array.

Jumping several PHP versions at once

You can move from 8.2 straight to 8.5, and often should, because every version you stop on is another round of testing and another end-of-life date. The cost is that you meet three hops of changes in one test run.

Five steps for upgrading across several PHP versions: log deprecations on the current version, check package PHP ranges, run tests on the target version, scan with tools, and match workers, cron and CLI

What we recommend:

  1. Log deprecations on the version you run today. Set error_reporting to E_ALL and collect E_DEPRECATED for a week of real traffic and background jobs. Fix those first, since they are the changes PHP has already announced.
  2. Check the dependencies. Run composer outdated and read each package’s supported PHP range. Old packages are the usual blocker, not your own code.
  3. Run the test suite on the target version in CI. If you have no tests, add smoke tests for logins, checkout, imports and scheduled jobs first.
  4. Scan with tools, then read the output. PHPCompatibility is a set of PHP_CodeSniffer rules that checks cross-version compatibility, and you pass a testVersion such as 8.2-. Rector’s page says it supports upgrades from PHP 5.3 to 8.5; we could not confirm 8.6 coverage from that page.
  5. Match every environment. Queue workers, cron and CLI scripts often run a different PHP binary from the website.

If you are not sure how many hops you are really facing, or nobody owns the code, see what the first two weeks of an inherited PHP application look like. Framework version limits matter as much as PHP’s own: our Laravel upgrade guide covers which Laravel versions run on which PHP.

PHP version upgrade summary table

Hop Main break to check Typical effort signal
8.2 to 8.3 Negative array index, range(), Date exceptions Low if your code already runs clean on 8.2 with deprecations logged
8.3 to 8.4 Implicitly nullable parameters, PDO attribute types, exit(), opcache JIT settings Moderate: the nullable deprecation shows up in many older packages
8.4 to 8.5 Cast names, null array offsets, opcache loading, PDO driver constants Low to moderate: mostly deprecations, plus config edits
8.5 to 8.6 Session defaults, finally returns, new ValueError cases Moderate if you use cross-site POST flows or custom session handlers; low otherwise

The effort column is a rough signal from the migration guides, not a quote. Your own test coverage and dependency age matter more than the version numbers.

Where we can help

If you want a second opinion on an upgrade, our PHP developers in Sydney do these moves, including Laravel upgrades and wider framework upgrades. For an application that has been left behind or has lost its owner, see our project rescue work.


Sources: PHP supported versions, Migrating from PHP 8.2.x to PHP 8.3.x: backward incompatible changes and deprecated features, Migrating from PHP 8.3.x to PHP 8.4.x: backward incompatible changes and deprecated features, Migrating from PHP 8.4.x to PHP 8.5.x: backward incompatible changes and deprecated features, PHP 8.6 release announcement, PHP 8.6 backward incompatible changes and other changes (PHP), PHPCompatibility and Rector (all checked 29 November 2026).

Common questions

What are the PHP 8.2 to 8.3 breaking changes?

The ones that reach real applications are the negative array index change (the next index after a negative key on an empty array is now $n+1, not 0), stricter range() behaviour, the Date extension throwing DateError and DateException classes instead of warnings, and static properties in traits being redeclared per class. Most of the rest of the 8.3 list is deprecations, which log notices rather than stop the site.

What are the PHP 8.3 to 8.4 breaking changes?

The main one is the deprecation of implicitly nullable parameters (Type $x = null), which can flood logs. Also check exit() now behaving like a function, the removed E_STRICT level, PDO attribute values that must now be booleans, the opcache.jit default moving to disable, and the deprecated session.sid_length and session.sid_bits_per_character settings.

Can I upgrade PHP 8.2 to 8.5 in one step?

Yes, PHP does not force you to install each version in between. But you take on three hops of changes at once, so read each migration guide, run your tests on 8.5 with E_ALL and deprecations logged, and confirm your framework and extensions list 8.5 as supported. For an application with weak test coverage, stepping through 8.3 and 8.4 on a branch makes it easier to see which change broke what.

What is the difference between PHP 8.2 and 8.5?

For support, 8.2 receives security fixes only until 31 December 2026, while 8.5 has active support until 31 December 2027 and security fixes until 31 December 2029. For code, you cross three sets of backward-incompatible changes and many deprecations, such as implicit nullable parameters in 8.4 and the (integer) and (boolean) cast names in 8.5.

Do PHP deprecations break my site?

A deprecation emits an E_DEPRECATED notice and the code still runs. It becomes a failure only if your error handler turns notices into exceptions, or if a later version removes the feature. Treat the deprecation log as your upgrade to-do list: fix it while it is only a notice.

Start a conversation

Start a conversation

Tell us what you want to build, fix or scale, we’ll come back with a clear way forward.