PHP 8.6 release highlights and a migration checklist for websites

The PHP team released PHP 8.6.0 on November 19. If you maintain a CMS, an API or a queue worker, plan the runtime upgrade first. Your shared code can start requiring 8.6 once every process that loads it runs the new version. A web server upgrade can leave a scheduled job on an older PHP executable.

A callback with one argument left open

Partial function application lets you fix some arguments now and supply the others later. Suppose a report prints every price with two decimal places. In PHP 8.6 you can define the formatter once and call it for each price.

$formatPrice = number_format(?, 2, '.', '');
echo $formatPrice(12.5); // 12.50

The question mark leaves a place for the price. The result is a closure you can call directly or pass to array_map(). An older PHP runtime cannot parse that first line, even if it never calls the formatter. Keep the existing callback in any package that still supports earlier versions.

For long-running services, Io\Poll lets an event loop wait for activity on many streams using the operating system’s polling facilities. A site benefits when its application or a library uses that API. Other additions include Time\Duration for elapsed intervals such as retry delays, clamp() for keeping a value within bounds, and SortDirection for expressing sort order. The PHP 8.6 feature overview has worked examples.

A staging checklist for websites

  1. Check what each process runs. Compare the PHP version and loaded extensions for the web server’s PHP-FPM pool, scheduled commands and queue workers. php -v identifies the command-line interpreter you just invoked.
  2. Check the application’s requirements. Read the 8.5 to 8.6 migration guide, especially the incompatible changes and deprecations. Check that your framework, locked Composer dependencies and required extensions support the target runtime.
  3. Replay requests you can compare. Run the test suite, then try a sign-in, a file upload and a JSON request that should return a validation error. Compare the status, content type and response body with the current deployment, including accented text. Our guide to JSON, forms and multipart requests explains which body to send. Save repeatable examples with the cURL command line builder.
  4. Run a background job and read the logs. Enable deprecation reporting in staging and keep diagnostics out of public responses. If the deployment also changes assets or caching, check the Cache-Control and ETag headers before attributing stale content to PHP.

Security fixes while you test

On November 19 the project also released 8.5.13, 8.4.28, 8.3.37 and 8.2.36 as security updates. If the 8.6 migration needs more time, apply the applicable fix for your current branch through your usual package or hosting provider. The PHP release archive records those November versions. Our October PHP security update guide explains how to confirm that the running workers picked up an update.

Premium is coming soon

An optional premium subscription to remove ads is planned. Subscriptions are not available yet.

You can keep using our free tools without an account.