Blog

25 April 2024

PHP 8.4: Release date, new features, and what changed

PHP 8.4

PHP 8.4 is currently in active development and is the target for new features and significant changes. It is scheduled for general availability on November 21, 2024. This upcoming release will introduce several enhancements and improvements.

New Features

Let's explore the new features in PHP 8.4:

  • Sodium Enhancements: In PHP 8.4, the Sodium extension introduces support for two new encryption algorithms: AEGIS-128L and AEGIS256.

  • Mbstring: PHP 8.4 adds new functions mb_ucfirst, mb_lcfirst, mb_trim, mb_ltrim, and mb_rtrim for multibyte string manipulation.

  • HTTP Response Headers: The http_(get|clear)_last_response_headers functions allow you to retrieve or clear the last HTTP response headers.

  • Curl Improvements: The curl_version() function now provides a feature_list that details supported features.

  • Regular Expression Updates: PHP 8.4 upgrades to PCRE2 for regular expressions, bringing enhanced performance and features.

  • Request Body Parsing: The new request_parse_body function simplifies parsing request bodies.

  • DateTime Microseconds: The DateTime and DateTimeImmutable class gains getMicrosecond, setMicrosecond, and createFromTimeStamp methods.

  • Rounding Modes: Additional rounding modes are available in the round() function.

What Changed

PHP 8.4 is shaping up to be a powerful release, so what are the changes in this version?

  • Invalid rounding modes in round() now throw \\ValueError exceptions.

  • The minimum required OpenSSL version is increased to 1.1.1.

  • The minimum required libcurl version is raised to 7.61.0.

  • Opcache configuration changes affect how JIT is enabled.

  • The PHP_ZTS and PHP_DEBUG constants now have a value type of bool instead of int.

  • Default Bcrypt cost for password hashing is now 12 instead of 10.

Deprecated / Removed

Several features have been deprecated or removed in PHP 8.4. Let’s take a closer look:

  • Implicitly Nullable Parameter Declarations: In PHP 8.4, implicitly nullable parameter declarations are deprecated. This means that parameters without an explicit ? for nullability will trigger a deprecation warning.

  • Curl: CURLOPT_BINARYTRANSFER: The CURLOPT_BINARYTRANSFER option in the Curl extension is deprecated. Developers are encouraged to use other options instead.

  • OCI8 and PDO-OCI Extensions: These extensions have been moved from PHP Core to PECL. If you rely on them, consider updating your code.

  • IMAP Extension: The IMAP extension has also been moved from PHP Core to PECL.

  • Pspell Extension: The Pspell extension has been removed from PHP Core and is now available via PECL.

These deprecations and removals are part of PHP 8.4 ongoing development, aiming for better performance, security, and maintainability. Developers should review their code and adapt to these changes to ensure compatibility with this future PHP version.