Blackfire now supports PHP 8.5
PHP 8.5 is out, and Blackfire supports it on release day.
PHP 8.5 is here, and we’re ready for it
We are thrilled to announce that Blackfire officially supports PHP 8.5 on day one. You can upgrade and experiment. Your observability stack is already prepared to support you at the forefront of PHP development.
What’s new in PHP 8.5?
PHP 8.5 ships a handful of features that are small on paper but big in day-to-day ergonomics.
Pipe operator (|>)
The headline feature is the pipe operator:
$result = 'Hello World'
|> trim(...)
|> strtoupper(...)
|> md5(...);
It lets you pass the result of an expression into a callable in a clean, left-to-right style.
It works with:
- Any callable (functions, static methods, object methods, closures)
- Proper type checks and coercions
- Functions that take only the first parameter from the previous expression
Much nicer than deeply nested calls or temporary variables all over the place.
New cURL helper: curl_multi_get_handles()
Working with multi cURL got a bit more practical.PHP 8.5 adds curl_multi_get_handles(), which returns all CurlHandle objects attached to a CurlMultiHandle:
$cm = curl_multi_init();
$ch1 = curl_init('https://blackfire.io/foo');
$ch2 = curl_init('https://upsun.com/bar');
curl_multi_add_handle($cm, $ch1);
curl_multi_add_handle($cm, $ch2);
$handles = curl_multi_get_handles($cm); // [$ch1, $ch2]
New array helpers: array_first() and array_last()
My personal favorite: two new functions make everyday array operations more explicit:
array_first(array $array): mixed– returns the first value, ornullif the array is emptyarray_last(array $array): mixed– returns the last value, ornullif the array is empty
They work on both indexed and associative arrays, and null can still be a perfectly valid array value.
New CLI flag: php --ini=diff
Debugging config changes gets easier with the new:
php --ini=diff
This prints only non-default INI directives, i.e., those that differ from the built-in defaults. Handy when you’re tracking down “it works on my machine” config ghosts.
New INI directive: max_memory_limit
Finally, PHP 8.5 introduces max_memory_limit, an INI directive that defines an upper ceiling for memory_limit.
- max_memory_limit is set at system level (
INI_SYSTEM), not changeable at runtime - If a script tries to set memory_limit above
max_memory_limit, PHP:- Emits a warning
- Forces
memory_limitback tomax_memory_limit
Example:
# ini max_memory_limit = 256 memory_limit = 128
ini_set('memory_limit', '300M'); will return as warning, and the effective limit becomes 256M.
Upgrade to PHP 8.5 today
Check our upgrade guide to embrace PHP 8.5, and let us know what Blackfire helps you achieve.
To better observability and beyond