PHP 8.4 is available on all servers
PHP 8.4 is now available on servers managed by ServerPilot. There are many improvements, changes, new features, and deprecations in PHP 8.4.
PHP 8.4 was released for General Availability (GA) on November 21, 2024.
All servers have been updated from the Release Candidate (RC) to the GA release.
Here we’ll provide a summary of the most important changes in PHP 8.4. For the full list of changes, see PHP’s official documentation on migrating code from PHP 8.3 to 8.4.
PHP 8.4 is available on servers running Ubuntu 20.04 and newer.
Changes in PHP 8.4
New Features in PHP 8.4
Property Hooks
Object properties may now have additional logic associated with their get and set operations. Learn more.
Asymmetric Property Visibility
Object properties may now have their set visibility controlled separately from the get visibility. Learn more.
Lazy Objects
It is now possible to create objects whose initialization is deferred until they are accessed. Learn more.
#[\Deprecated]
attribute
The new Deprecated attribute can be used to mark functions, methods, and class constants as deprecated. Learn more.
Chaining new
expressions without parentheses
new
expressions with constructor arguments now allow chaining method
calls, property accesses, etc. without enclosing the expression in
parentheses. Learn
more.
Improved Debugging Info for WeakReference
Getting the debug info for WeakReference
will now also output the
object it references, or null if the reference is no longer valid.
Learn
more.
Improved Debugging Info for Closure
The output of Closure::__debugInfo()
now includes the name, file, and
line of the Closure. Learn
more.
Defining Identical Symbols in Different Namespace Blocks
Exiting a namespace now clears seen symbols. This allows using a symbol in a namespace block, even if a previous namespace block declared a symbol with the same name. Learn more.
New PCRE (regular expressions) features
Spaces are now allowed between braces in Perl-compatible items. Variable-length lookbehind assertions are now supported. Learn more.
New cURL features
New cURL options accept callables to be called either after the
connection is made or throughout the request lifetime. Also, the
curl_getinfo()
now returns a posttransfer_time_us
key with the total
request time. Learn
more.
New Function request_parse_body()
in PHP 8.4
The new request_parse_body()
function in PHP 8.4 allows parsing
RFC1867 (multipart) requests in non-POST HTTP requests. The addition of
this function fixes a popular PHP bug from
2011.
// Parsing a PUT request[$_POST, $_FILES] = request_parse_body();
var_dump($_POST); // [...]var_dump($_FILES); // [...]
Backward-Incompatible Changes in PHP 8.4
Changes in PHP 8.4 that are not backward-compatible will prevent code written for earlier PHP versions from working in PHP 8.4
Removal of E_STRICT
error level
The E_STRICT
error level has been removed, as it was no longer in use
within the PHP engine. The E_STRICT
constant has also been deprecated.
Learn
more.
exit()
and die()
behavior changes
The exit()
and die()
language constructs now behave more like
functions. This means they can now be passed like callables. Learn
more.
Deprecations in PHP 8.4
- Calling
trigger_error()
with error_level being equal toE_USER_ERROR
is now deprecated. Such usages should be replaced by either throwing an exception or callingexit()
. - Because the
E_STRICT
error level was removed, this constant is now deprecated.
Extensions moved to PECL in PHP 8.4
IMAP
Starting with PHP 8.4, the IMAP extension is no longer part of PHP core. Instead, the IMAP extension can be installed through PECL.
Pspell
Starting with PHP 8.4, the Pspell extension is no longer part of PHP core. Instead, the Pspell extension can be installed through PECL.
How to Switch to PHP 8.4
You can change an app to use PHP 8.4 through your app’s Settings in ServerPilot. If your app does not work with PHP 8.4, you can easily change back to the PHP version you were using before.
As always, please contact us if you have any questions.