PHP 8.6.0 RC3 available for testing

Other Changes

Core changes

Core

In case of a hard OOM (out of memory) condition, PHP now calls abort() instead of exit(1), changing the exit code to 134 and possibly creating a core dump.

The PHP_OS_FAMILY constant has an AIX value for when running on AIX or IBM i via PASE.

Changes in SAPI Modules

CLI

The built-in development server now accepts requests using the HTTP QUERY method instead of returning 501 Not Implemented.

The built-in development server no longer reflects the Host header from requests.

Changed Functions

Core

header_register_callback() now declares true as its return type. It has not been able to return false since PHP 8.0.0, when passing an invalid callback started throwing a TypeError instead.

register_tick_function() now declares true as its return type. It has always returned true on success; an invalid callback throws a TypeError during argument parsing before the function body is reached.

ini_get_all() now includes a "builtin_default_value" element for each directive when details is true. It holds the built-in default value of the directive (or null if it has none), independent of values set in php.ini, on the command line, or at runtime.

fclose(), file_put_contents() and copy() now return false when flushing or closing the stream fails. Previously such failures were silently ignored.

Filter

The return type of filter_var_array() has been narrowed from array|false|null to array|false. The function always establishes an array before filtering, so null was never returned. filter_input_array() is unaffected: it still returns null when the requested superglobal does not exist.

LDAP

The return type of ldap_free_result() has been narrowed from bool to true. The function already always returned true.

MySQLi

The return structure of mysqli_get_charset() no longer contains the undocumented "comment" element. The value of "charsetnr" is now set to a constant 0 as this number was an implementation detail that should not have been exposed to the public.

OpenSSL

The output of openssl_x509_parse() now contains a "criticalExtensions" entry listing all critical certificate extensions.

openssl_sign() and openssl_verify() now have an additional optional salt_length argument that allows controlling the RSA-PSS salt length when OPENSSL_PKCS1_PSS_PADDING is used. It accepts an explicit length or one of the new OPENSSL_RSA_PSS_SALTLEN_* constants.

PDO_DBLIB

When using persistent connections, there is now a liveness check in PDO::__construct().

Phar

Phar::mungServer() now supports reference values.

Readline

readline_completion_function() now declares true as its return type. It has always returned true on success; an invalid callback throws a TypeError during argument parsing before the function body is reached.

Reflection

The outputs of ReflectionClassConstant::__toString() and ReflectionConstant::__toString() now print bool constant values as true and false rather than 1 and an empty string. This also affects other ways of printing class constants, e.g. ReflectionClass::__toString().

Sockets

socket_addrinfo_lookup() now has an additional optional error_code argument that, when not null, receives the error code on failure (one of the EAI_* constants).

The return type of socket_cmsg_space() has been narrowed from ?int to int. Every failure path has thrown a ValueError since PHP 8.0.0, so null was never returned.

Zip

The return type of zip_entry_close() has been narrowed from bool to true. The function already always returned true.

Other Changes to Extensions

Fileinfo

Upgraded to file 5.48. Custom compiled magic databases from older file versions must be regenerated.

Hash

The bundled version of xxHash was upgraded to 0.8.2.

MySQLi

Added the new constant MYSQLI_OPT_COMPRESS.

Opcache

JIT is now supported for ZTS builds on Apple Silicon.

Changes to INI File Handling

Core

The error_include_args INI option has been added to make the display of function arguments consistent in errors; it is off by default. Previously, whether a function showed a parameter in the error was up to each call to the internal error function. Now, all parameters as they were actually passed to the function will be displayed. This uses the same infrastructure as stack traces, so sensitive parameters will not be displayed, and strings will be truncated according to zend.exception_string_param_max_len.

MBString

The mbstring.detect_order INI directive now updates the internal detection order when changed at runtime via ini_set(). Previously, runtime changes using ini_set() did not take effect for mb_detect_order(). Setting the directive to null or an empty string at runtime now leaves the previously configured detection order unchanged.

MySQLi

mysqli.default_port now checks the validity of the value, which should be between 0 and 65535 inclusive.

Opcache

opcache.jit_debug accepts a new flag: ZEND_JIT_DEBUG_TRACE_EXIT_INFO_SRC. When used along with ZEND_JIT_DEBUG_TRACE_EXIT_INFO, the source of exit points is printed in the exit info output, in debug builds.

Performance

Core

printf() using only %s and %d will be compiled into the equivalent string interpolation, avoiding the overhead of a function call and repeatedly parsing the format string.

Arguments are now passed more efficiently to known constructors (e.g. when using new self()).

array_map() using a first-class callable or partial function application callback will be compiled into the equivalent foreach loop, avoiding the creation of intermediate Closures, the overhead of calling userland callbacks from internal functions and providing for better insight for the JIT.

The performance of the TAILCALL VM has been improved, and it is now enabled on Windows when compiling with Clang 19 or later on x86_64.

The performance of ZTS builds has been improved.

Added a stateless closure cache.

Deeply recursive code that causes the VM to allocate new stack pages should now be faster.

Improved performance of sorting single-element arrays.

Improved performance of the following functions:

DOM

Made DOMText::splitText() and Dom\Text::splitText() faster and consume less memory.

GD

imagebmp(), imagewbmp(), imagegd(), and imagegd2() now buffer output when writing to PHP streams, significantly improving performance when writing images to files.

Improved performance of imagegrabscreen() and imagegrabwindow() on Windows.

Intl

Improved performance of IntlCalendar::getAvailableLocales() and IntlDateFormatter::localtime()/datefmt_localtime() by pre-allocating their returned arrays.

Improved performance of transliterator_list_ids() and resourcebundle_locales() by pre-allocating their returned arrays.

Optimized callback invocation in IntlChar::enumCharTypes().

JSON

Improved performance of encoding arrays and objects.

Improved performance of indentation generation in json_encode() when using JSON_PRETTY_PRINT.

MBString

Improved performance of mb_str_pad().

Phar

Reduced temporary allocations when iterating Phar directories.

URI

Improved performance of Uri\WhatWg\Url::parse() when collecting validation errors by pre-allocating the error array.

Reduced allocations when reading IPv6/IPvFuture hosts and paths with Uri\Rfc3986\Uri.

Improved performance and memory consumption when using normalizing (non-raw) getters on already-normalized URIs with Uri\Rfc3986\Uri.

Zip

Improved performance of ZipArchive::addGlob() and ZipArchive::addPattern() by pre-allocating their returned arrays.

Avoid string copies in ZipArchive::addFromString().

+add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top