Skip to content
Putting technology to work.
Insights to guide decisions and action.

Search articles

Migrating to PHP 8.6: session cookie defaults change

Table of contents · 7 items

After upgrading to PHP 8.6, the login state or cart contents disappear when users return from an external payment page or single sign-on page. The changes in 8.6 include some that can lead to symptoms like this, because three session cookie defaults have changed to safer values.

The PHP development team released 8.6.0 (the stable release) on November 19, 2026. The announcement lists partial function application, default values for readonly properties, the clamp() function and the \Time\Duration class among the main new features. However, when migrating an existing site, the parts to check first are "Backward Incompatible Changes" and "Deprecated Functionality" in the migration document (UPGRADING in php-src).

In this article, we lay out what to check before moving websites and business systems to 8.6, based on UPGRADING, the php.ini templates and the repositories of each framework and CMS. We have not tested by running 8.6.

Where 8.6 stands and when to migrate

According to the Supported Versions page on php.net, the deadlines for each branch are as follows.

  • 8.6: active support until December 31, 2028, and security fixes until December 31, 2030
  • 8.5: security fixes until December 31, 2029
  • 8.3: security fixes until December 31, 2027
  • 8.2: security fixes end on December 31, 2026

Sites running on 8.2 need to move to 8.3 or later rather than waiting for 8.6. Since 8.6 was released only recently, choose it only after confirming that the frameworks and plugins you use support it.

Framework and CMS support status (as of November 25)

Target8.6 supportBasis
WordPress 7.1.5 (latest release)Supported versions list goes up to 8.5.version-support-php.json in the wordpress-develop 7.1.5 tag
WordPress 7.2 (RC3, scheduled for release on December 8)Support declaredNovember 10 commit "Officially declare support for PHP 8.6."
Laravel 13.44.0 and later (November 24; 13.44.1 the same day)Tests 8.6 in CICommit "[13.x] Supports for PHP 8.6" (included in 13.44.0)
CakePHP 5.4.5 (November 22)Tests 8.6 in CI (removed the setting that allowed failures)November 9 commit "Remove PHP version ignore for 8.6"

The WordPress commit states, "All known PHP 8.6 compatibility issues have been addressed," and adds 8.6 to the supported versions list for 7.2. The list for the released 7.1 branch does not include 8.6. According to the Make WordPress Core schedule, 7.2 is scheduled for release on December 8. For WordPress sites, the safe order is to wait for the 7.2 release, upgrade WordPress itself, and then move PHP to 8.6. Check support for themes and plugins separately.

Three session cookie defaults

According to the Session section of "Backward Incompatible Changes" in UPGRADING, the following three defaults have changed. They are based on the accepted RFC "Secure Session Configuration Defaults" (targeting PHP 8.6, with a separate vote on each of the three changes, all with zero votes against). The same changes appear in the 8.6.0 NEWS and in the migration guide in the PHP manual (Backward Incompatible Changes). However, as of November 26, the list of settings in the PHP manual (Runtime Configuration for Sessions) still shows the defaults through 8.5 (session.use_strict_mode is Off and session.cookie_samesite is empty).

ConfigurationDefault through 8.5Default in 8.6Affected processing
session.use_strict_mode01Code that starts a session with an ID passed in from outside (the RFC's example is passing IDs between subdomains), and custom handlers that accept IDs not present in storage
session.cookie_httponly01JavaScript code that reads the session cookie via document.cookie
session.cookie_samesite(None)LaxCode that assumes the session cookie is sent with POST requests from other sites

The third change leads to the symptoms described at the start. UPGRADING states, "Session cookies are no longer sent on cross-site requests other than top-level navigations using safe HTTP methods." Session cookies are not sent with POST requests from other sites. The RFC lists "SP-initiated SAML SSO flows" (SAML single sign-on initiated by the service side) as an affected example. Our view is that code that receives results via POST from a payment provider's page may fit the same pattern. UPGRADING says that for this kind of processing, you should set session.cookie_samesite to None and set session.cookie_secure to 1.

According to the RFC, Chrome and Firefox already treat cookies without a SameSite attribute as Lax. Safari does not use Lax as the default. The RFC explains that this change removes the differences between browsers. For this reason, our reading is that even in environments running 8.5 or earlier, the same symptoms may already be occurring in some browsers.

In addition, like the security update released the same day, 8.6.0 includes the change that sets the default of session.upload_progress.enabled to Off (if it stays On, changing session settings at runtime raises an Error). This change is not mentioned in UPGRADING. We cover it in detail in our article on PHP's November fixes.

If you carry over an existing php.ini, the new defaults do not take effect

This is where the way php.ini is written determines the outcome. The 8.5.13 template (php.ini-production) contains the following lines, not commented out.

session.use_strict_mode = 0
session.cookie_httponly =
session.cookie_samesite =

In the 8.6.0 template, the same lines changed to = 1, = 1 and = "Lax". If you use an old php.ini as is with the new PHP, the explicit 0 and empty values take precedence over the built-in defaults. As a result, even after upgrading to 8.6, the three values remain the same as through 8.5. Conversely, if you recreate php.ini from the new template, or if the OS package ships the new settings, you get the new values.

After upgrading, check which values you ended up with using php -i.

php -i | grep -E "session\.(use_strict_mode|cookie_httponly|cookie_samesite|cookie_secure)"

PHP running on a web server (such as PHP-FPM) may read a different php.ini from the command line. It is more reliable to check phpinfo() through the same path as production.

A chart comparing the php.ini-production entries in 8.5.13 and 8.6.0 with the built-in defaults for the three session cookie settings in PHP 8.6. The 8.5.13 template explicitly sets use_strict_mode = 0 and empty values for cookie_httponly and cookie_samesite. The 8.6.0 template sets 1, 1 and Lax. If you carry over an old php.ini, the explicit values take precedence, and 8.6 uses the same values as through 8.5

Deprecations that require rewrites, and behavior changes

From "Deprecated Functionality" in UPGRADING, the items most likely to be used in Japanese-language websites and business systems are as follows. Deprecations only produce warnings and still work in 8.6.

  • mbstring regular expressions (Mbregex): "Mbregex has been deprecated, because the underlying Oniguruma library is no longer maintained." In the 8.6.0 definitions (mbstring.stub.php), #[\Deprecated(since: '8.6')] is attached to mb_ereg(), mb_eregi(), mb_ereg_replace(), mb_split(), mb_regex_encoding(), the mb_ereg_search family and others
  • Custom session handlers: implementing SessionHandlerInterface in a class that does not define create_sid() and validateId() triggers a deprecation warning. Passing such an object to session_set_save_handler() is also deprecated
  • spl_object_hash(): the documentation says to replace it with spl_object_id()
  • is_integer(), is_long(), is_double() and doubleval(): replaced by is_int(), is_float() and floatval() respectively
  • return inside finally, returning a value from __construct(), and the third argument of define()

Among behavior changes, the form feed (\f) has been added to the characters that trim(), rtrim() and ltrim() remove by default. Comparisons that assume results match those through 8.5, and expected values in tests, may change.

To find these in your code, you can use searches like the following.

grep -rnE "\b(mb_ereg[a-z_]*|mb_eregi[a-z_]*|mb_split|mb_regex_encoding|spl_object_hash|is_integer|is_long|is_double|doubleval)\s*\(" \
  --include="*.php" src/ app/ wp-content/themes/ 2>/dev/null

A candidate replacement for the mb_ereg family is the preg_* functions with the u modifier. However, Oniguruma and PCRE differ in the details of regular expression syntax. Verify the replaced code with tests that use Japanese input.

Migration steps (our suggestion)

  1. Check your current version and its deadline. If you are on 8.2, make moving to 8.3 or later a task for this year rather than waiting for 8.6
  2. Check 8.6 support in the frameworks, CMS and major libraries you use. For WordPress, wait for the 7.2 release
  3. Decide how to handle php.ini. Decide whether to carry it over or create it from the new template, and choose the three session values deliberately. If you have processing that returns via POST from other sites, identify those paths
  4. Find deprecated functions, and test with warnings enabled. In your test environment, set error_reporting=E_ALL and collect deprecation warnings in the logs
  5. Check phpinfo() through the same path as production before switching over

Scope of verification

On November 25, 2026, we checked the php.net announcement (PHP 8.6.0 Released!, November 19, 2026), the support period calculation (include/branches.inc in php/web-php), UPGRADING, php.ini-production, ext/session/session.c and ext/mbstring/mbstring.stub.php in the php-8.6.0 tag of php/php-src, and php.ini-production in php-8.5.13. We checked the repositories for WordPress (the 7.1.5 tag and the 7.2 branch of wordpress-develop, commit 0747041), Laravel (tag v13.44.0 and commit b9bb152 of laravel/framework) and CakePHP (tag 5.4.5 and commit af84c4b of cakephp/cakephp). On November 26, we checked the php.net announcement and the supported versions page, the RFC (wiki.php.net), the 8.6.0 NEWS, the migration guide and the list of settings in the PHP manual, the WordPress 7.2 schedule (Make WordPress Core), and the latest versions of Laravel and CakePHP on Packagist (document research). We have not checked behavior on PHP 8.6, the behavior of individual frameworks, CMSs and plugins on 8.6, or the availability of 8.6 in OS packages or on shared hosting.

The security updates such as 8.5.13, released on the same day as 8.6, are covered in our article on PHP's November fixes. The background to the 8.2 deadline is in our article on PHP's emergency update in October, and the points to check before and after updating WordPress itself are summarized in our article on WordPress 7.1.5.

For version upgrades of PHP-based sites, or redesigns timed with an upgrade, please contact us through consultation on development, AI, and automation.

References

Share this articleXFacebook
Kakeru Suzuki

Fascinated by the possibilities of technology, has had a deep interest in programming and digital art since student days

Turn this article's theme into your company's next step

Starting from what you want to achieve with your website.

We organize user goals, required features, and ongoing maintenance structures to determine the first steps in development and improvement.

  • Website objectives
  • Features and usability
  • Post-launch operations
Consult on web development and improvements

You can consult with us from the initial conceptual stage. Details from this article will be carried over to the inquiry form.

Receive the latest articles via email · Read the web production guide
Free download

Complete Guide to Web Production: Costs, Vendor Selection & Traffic Acquisition [2026 Edition]

We have compiled cost benchmarks, vendor selection criteria, and traffic acquisition strategies into a PDF.

The PDF and newsletter emails are currently in Japanese.

You will also be subscribed to our newsletter. You can unsubscribe at any time.