Repository navigation
PHP 8.6 documentation tracker #5901
Copy link
Copy link
Open
Description
Pages which need to be added/modified for complete documentation of PHP 8.6:
Note
This issue is still a Work In Progress
Important
Priority should be given to documenting Core language and ext/standard behavioral changes
Source: https://github.com/php/php-src/blob/PHP-8.6/UPGRADING
Migration Guide
Core
Backward Incompatible Changes
- By-reference
foreachloops may now visit previously skipped elements after array compaction. Internal pointers on deleted elements now move to the next surviving element during copy-on-write. -
??/empty()on a magic property no longer call__get()when__isset()has materialized the property by writing into the property table. The freshly-written value is returned directly.isset()is unaffected. -
array_intersect()with at least two arrays now converts values to strings while scanning its inputs instead of during sort comparisons. This can change the number and order of conversion warnings and__toString()calls, which conversion exception is reached, and the result for stateful__toString()implementations. Argument types are validated before checking for empty arrays or converting values. Values are not converted if any input array is empty. - Form feed (
\f) is now added to the default trimmed characters oftrim(),rtrim()andltrim(). RFC: https://wiki.php.net/rfc/trim_form_feed -
base_convert(),bindec(),hexdec()andoctdec()now raise a notice when they cannot precisely convert the given number. -
setlocale(): arrays are now accepted only for the$localesargument. Passing an array as a later variadic locale argument now throws aTypeError. Passing any additional locale arguments when$localesis an array now throws anArgumentCountError. -
unpack()now reads a<or>immediately following a format code as an endianness modifier rather than as the first character of the element name. Formats such as"s<value"now produce the key"value"instead of"<value", and"C>name"raises aValueErrorbecause theCformat code accepts no endianness modifier. A name starting with these characters is unaffected when a repeater precedes it, as in"s1<value". RFC: https://wiki.php.net/rfc/pack-unpack-endianness-signed-integers-support -
fclose(),file_put_contents()andcopy()now returnfalsewhen flushing or closing the stream fails. Previously such failures were silently ignored.
Deprecations
- Using
namespaceas a class constant name is deprecated. RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_using_namespace_as_a_class_constant_name - Using the
returnstatement in afinallyblock is now deprecated. RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_returning_from_a_finally_block - Specifying a return type of
array|null/?arrayfor__debugInfo()is now deprecated. Specifyarrayinstead. - Returning values from
__construct()and__destruct()is now deprecated. RFC: https://wiki.php.net/rfc/deprecate-return-value-from-construct - Making
__construct()and__destruct()aGeneratoris now deprecated. RFC: https://wiki.php.net/rfc/deprecate-return-value-from-construct - Naming a function
readonlyis now deprecated. RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_the_possibility_to_name_a_function_readonly - Using
letas the name of a class, interface, trait, enum, function, or constant (including viadefine()), as the alias passed toclass_alias(), or as the alias name in ause,use function, oruse constdeclaration is now deprecated. RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_using_let_as_an_identifier - Using
isas the name of a class, interface, trait, enum, function, or constant (including viadefine()), as the alias passed toclass_alias(), or as the alias name in ause,use function, oruse constdeclaration is now deprecated. RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_using_is_as_an_identifier - Using
_as a constant name (viaconstordefine()), or as the alias name for a class or constant in ausedeclaration, is now deprecated. This extends the PHP 8.4 deprecation of_as a class name. RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_using_as_a_constant_and_compile_time_alias - Passing a 3rd argument to
define()is now deprecated. RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_define_with_case_insensitive_being_specified - Calling
is_a()with a string as the first argument when$allow_stringisfalseis now deprecated. RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_is_a_with_string_when_allow_string_is_false - Calling
is_subclass_of()with a string as the first argument when$allow_stringisfalseis now deprecated. RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_is_subclass_of_with_string_when_allow_string_is_false -
metaphone()is deprecated. Please use a userland phonetic matching library instead. RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_metaphone_function - Using more than 16 filters in a
php://filterURL without configuring thefilter.max_filter_countstream context option now emits anE_DEPRECATEDwarning. Usestream_filter_append()or configure this option explicitly. RFC: https://wiki.php.net/rfc/limit-maximum-number-of-filter-chains - Passing an object to
array_walk()/array_walk_recursive()is now deprecated. Useget_object_vars()on the object instead. RFC: https://wiki.php.net/rfc/deprecations_php_8_6#passing_objects_for_array_parameter_of_array_walk_and_array_walk_recursive - Passing an object as the
$dataargument tohttp_build_query()is now deprecated. The interpretation of object values within$dataas arrays is also deprecated. Convert objects to arrays withget_object_vars()before calling the function. RFC: https://wiki.php.net/rfc/deprecations_php_8_6#passing_objects_for_data_parameter_of_http_build_query - The
is_double()function is now deprecated. Useis_float()instead. RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_is_double - The
is_long()functions are now deprecated. Useis_int()instead. RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_is_long - The
is_integer()functions are now deprecated. Useis_int()instead. RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_is_integer - The
doubleval()function is now deprecated. Usefloatval()instead. RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_doubleval - The
strcoll()function is now deprecated. UseCollator::compare()instead. RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_strcoll - The
SORT_LOCALE_STRINGconstant for the family of sort functions is now deprecated. UseCollator::sort(),Collator::asort()orCollator::sortWithSortKeys()instead. RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_sort_locale_string_flag_for_sort_functions
INI changes
- Added the
error_include_argsINI option to make the display of function arguments consistent in errors; it is off by default. All parameters as actually passed to the function will be displayed, using the same infrastructure as stack traces (sensitive parameters are hidden, strings are truncated according tozend.exception_string_param_max_len). RFC: https://wiki.php.net/rfc/display_error_function_args
New classes
- enum
SortDirection. RFC: https://wiki.php.net/rfc/sort_direction_enum - Stream errors API. RFC: https://wiki.php.net/rfc/stream_errors
-
StreamError -
StreamException - enum
StreamErrorStore - enum
StreamErrorMode - enum
StreamErrorCode
-
- Polling API. RFC: https://wiki.php.net/rfc/poll_api
-
Io\Poll\Context -
Io\Poll\Watcher - enum
Io\Poll\Backend - enum
Io\Poll\Event - interface
Io\Poll\Handle -
StreamPollHandle -
Io\IoException -
Io\Poll\PollException -
Io\Poll\FailedPollOperationException -
Io\Poll\FailedContextInitializationException -
Io\Poll\FailedHandleAddException -
Io\Poll\FailedWatcherModificationException -
Io\Poll\FailedPollWaitException -
Io\Poll\BackendUnavailableException -
Io\Poll\InactiveWatcherException -
Io\Poll\HandleAlreadyWatchedException -
Io\Poll\InvalidHandleException
-
New functions
-
clamp()returns the given value if in range, else returns the nearest bound. RFC: https://wiki.php.net/rfc/clamp_v2 (Document clamp function #4814) -
stream_last_errors(). RFC: https://wiki.php.net/rfc/stream_errors -
stream_clear_errors(). RFC: https://wiki.php.net/rfc/stream_errors -
stream_socket_get_crypto_status()
New global constants
-
ARRAY_FILTER_USE_VALUE -
STREAM_CRYPTO_STATUS_NONE -
STREAM_CRYPTO_STATUS_WANT_READ -
STREAM_CRYPTO_STATUS_WANT_WRITE
New features
- Readonly properties may now declare default values. RFC: https://wiki.php.net/rfc/readonly_property_defaults
- It is now possible to use reference assignment on
WeakMapwithout the key needing to be present beforehand. - It is now possible to define the
__debugInfo()magic method on enums. RFC: https://wiki.php.net/rfc/debugable-enums -
#[\Override]can now be applied to class constants, including enum cases. RFC: https://wiki.php.net/rfc/override_constants - Partial function application. RFC: https://wiki.php.net/rfc/partial_function_application_v2
- Allow direct mutation of objects stored in constants or class constants via
OBJ->prop = $val. RFC: https://wiki.php.net/rfc/const_object_property_write -
pack()andunpack()now accept the<and>endianness modifiers on the signed and unsigned integer format codes. RFC: https://wiki.php.net/rfc/pack-unpack-endianness-signed-integers-support -
pack()andunpack()now accept the<and>endianness modifiers on the float and double format codes. RFC: https://wiki.php.net/rfc/pack-unpack-float-endianness-modifier
Changed functions
-
header_register_callback()now declarestrueas its return type. -
register_tick_function()now declarestrueas its return type. -
ini_get_all()now includes a"builtin_default_value"element for each directive when$detailsistrue. It holds the built-in default value of the directive (ornullif it has none), independent of values set in php.ini, on the command line, or at runtime.
Other changes
- In case of a hard OOM PHP now calls
abort()instead ofexit(1), changing the exit code to 134 and possibly creating a core dump. - The
PHP_OS_FAMILYconstant has anAIXvalue for when running on AIX or IBM i via PASE.
Streams
- Added new stream errors API. It is controlled using the
error_mode,error_storeanderror_handlerstream context options. RFC: https://wiki.php.net/rfc/stream_errors - Added the
filter.max_filter_countstream context option forphp://filterURLs. When set, opening the stream fails with a warning if the URL would add more filters than the configured value. Negative values disable the check. RFC: https://wiki.php.net/rfc/limit-maximum-number-of-filter-chains - Added socket context option
so_reuseaddrthat allows disabling address reuse (SO_REUSEADDR) and explicitly usesSO_EXCLUSIVEADDRUSEon Windows. - Added socket context options
so_keepalive,tcp_keepidle,tcp_keepintvlandtcp_keepcntthat allow setting socket keepalive options. - Added socket context option
so_lingerthat setsSO_LINGERon TCP sockets. A positive value enables lingering for that many seconds, zero or a negative value disables it. Values above 65535 are clamped. - Added socket context options
so_rcvbufandso_sndbufthat set the socket receive and send buffer sizes in bytes on TCP and UDP sockets. The value must be an integer between 1 and 2147483647; any other value makes the stream creation fail. - Allowed casting filtered streams as file descriptors for select.
- Added the
write_seek_modefilter parameter for the bz2, iconv, zlib, and string stream filters. It must be set via an associative array where the key is"write_seek_mode"and the value is one of"preserve","reset", or"strict".
New warnings and exceptions
Core (ext/standard)
-
array_filter()now raises aValueErrorwhen an invalid$modeargument value is passed. -
array_change_key_case()now raises aValueErrorwhen an invalid$caseargument value is passed. -
getenv()andputenv()now raise aValueErrorwhen the first argument contains NUL bytes. -
dl()now raises aValueErrorwhen the$extension_filenameargument contains NUL bytes. -
openlog()now raises aValueErrorwhen the$prefixargument contains NUL bytes. -
parse_str()now raises aValueErrorwhen the$stringargument contains NUL bytes. -
setlocale()now raises aValueErrorwhen a locale name contains NUL bytes, instead of silently truncating it. -
linkinfo()now raises aValueErrorwhen the$pathargument is empty. -
pathinfo()now raises aValueErrorwhen an invalid$flagsargument value is passed. -
scandir()now raises aValueErrorwhen an invalid$sorting_orderargument value is passed. -
number_format()now raises aValueErrorwhen$decimalsis outside the integer range instead of silently clamping very large positive values. -
sleep()now raises aValueErrorwhen$secondsis greater than the platform limit (UINT_MAXseconds, orUINT_MAX / 1000seconds on Windows) instead of allowing the value to overflow. -
usleep()now raises aValueErrorwhen$microsecondsis greater thanUINT_MAXinstead of allowing the value to overflow. -
proc_open()now raises aValueErrorwhen the$cwdargument contains NUL bytes. - The following functions now raise a
ValueErrorwhen the$filenameargument contains NUL bytes:-
fileperms() -
fileinode() -
filesize() -
fileowner() -
filegroup() -
fileatime() -
filemtime() -
filectime() -
filetype() -
is_writable() -
is_readable() -
is_executable() -
is_file() -
is_dir() -
is_link() -
file_exists() -
lstat() -
stat()
-
Curl
- The callback registered with
CURLOPT_READFUNCTIONnow throws aValueErrorwhen returning an integer other than0,CURL_READFUNC_ABORTorCURL_READFUNC_PAUSE.
DOM
- Array access on
Dom\DtdNamedNodeMapobjects now raises aValueErrorwhen the integer index is greater thanINT_MAXinstead of overflowing to a smaller index.
FTP
-
ftp_nb_fget(),ftp_nb_fput(),ftp_nb_get()andftp_nb_put()now throw anErrorwhen the connection is already transferring, instead of emitting a warning and returningfalse.
GD
-
imagesetstyle(),imagefilter()andimagecrop()filter the types / values of their array arguments and raise aTypeError/ValueErroraccordingly. -
imageaffinematrixget()now enforces the documentedarray|floattype for the$optionsparameter, including the corresponding weak and strict typing behavior.
GMP
-
gmp_fact()now throws aValueErrorif$numdoes not fit into an unsigned long. -
gmp_pow(),gmp_binomial(),gmp_root()andgmp_rootrem()now throw aValueErrorif their second argument does not fit into an unsigned long. - The shift (
<<,>>) and exponentiation (**) operators on GMP objects now throw aValueErrorwhen GMP right operands are outside the unsigned long range, instead of silently truncating them. - GMP integer string parsing now throws a
ValueErrorfor strings containing NUL bytes, instead of silently truncating them. -
gmp_powm()modulo-by-zero now raises aDivisionByZeroErrorwhose message includes the function name and argument index ($modulus).
Intl
- Passing a non-stringable object as a time zone to Intl APIs that accept time zone objects or strings now raises a
TypeErrorinstead of anError. -
IntlBreakIterator::getLocale()now raises aValueErrorwhen the type is neitherLocale::ACTUAL_LOCALEnorLocale::VALID_LOCALEinstead of returningfalse. -
UConverter::transcode()now rejectsfrom_substandto_substoption values longer than 127 bytes instead of silently truncating the length before passing it to ICU. -
IntlDateFormatter::parse()/datefmt_parse()andIntlDateFormatter::localtime()/datefmt_localtime()now raise aTypeErrorwhen the offset argument is not of type int instead of silently converting the value. -
Collator::sort(),collator_sort(),Collator::asort(), andcollator_asort()now report UTF-8/UTF-16 conversion failures during comparison through the intl error mechanism and returnfalse. Withintl.use_exceptionsenabled, these failures throwIntlException. Previously, these paths emitted a warning and compared the value as an empty string.
PCNTL
-
pcntl_alarm()now raises aValueErrorif the seconds argument is lower than zero or greater than the platform'sUINT_MAX. -
pcntl_exec()now raises aValueErrorif the$argsargument is not a list array.
PGSQL
-
pg_fetch_object()now reports theValueErrorfor a non-empty$constructor_argson a class without a constructor on the$constructor_argsargument instead of$class. Errors raised when the requested class is not instantiable (abstract, interface, enum) now surface before the row is fetched.
Phar
-
Phar::mungServer()now raises aValueErrorwhen an invalid argument value is passed instead of being silently ignored. -
Phar::addEmptyDir()now rejects"/.phar"paths in addition to".phar"paths, and raises the sameBadMethodCallExceptionfor attempts to create the reserved magic".phar"directory through that form.
Session
- Setting
session.cookie_path,session.cookie_domain, orsession.cache_limiterto a value containing NUL bytes now emits a warning and leaves the setting unchanged. - A
ValueErroris thrown if$nameis a string containing NUL bytes insession_module_name().
Shmop
-
shmop_open()now raises aValueErrorwhen the$keyargument is outside the platform'skey_trange instead of passing a truncated key to the operating system.
SimpleXML
-
SimpleXMLElement::__construct()now raises aValueErrorwhen the$dataargument contains NUL bytes, matchingsimplexml_load_file().
SOAP
-
SoapClientnow throwsTypeErrorfor non-array"classmap"options andValueErrorfor arrays containing integer keys, also when the"exceptions"option is disabled.
Sockets
-
socket_set_option()withSO_ATTACH_REUSEPORT_CBPFnow requires an int$valueand a$levelofSOL_SOCKET. Any other value type throws aTypeErrorinstead of being coerced, and any other level raises a warning and returnsfalse.
Sodium
-
sodium_crypto_pwhash(),sodium_crypto_pwhash_str(),sodium_crypto_pwhash_scryptsalsa208sha256()andsodium_crypto_pwhash_scryptsalsa208sha256_str()now throwValueErrorinstead ofSodiumExceptionwhen an argument is out of range, such as an opslimit or memlimit below the documented minimum.SodiumExceptionis still thrown for internal libsodium failures.
SPL
-
SplObjectStorage::getHash()implementations may no longer mutate anySplObjectStorageinstance. Attempting to do so now throws anError.
Sysvshm
-
shm_attach()now raises aValueErrorwhen the$keyargument is outside the platform'skey_trange instead of passing a truncated key to the operating system.
Zip
-
ZipArchive::extractTo()now raises aTypeErrorfor the files argument if one or more of the entries is not a string. -
ZipArchive::addGlob()andZipArchive::addPattern()now raise aTypeErrorwhen the"remove_all_path"option is not of type bool, or when the"comp_method","comp_flags", or"enc_method"options are not of type int (numeric strings are coerced), instead of emitting a warning. - Serializing or unserializing a
ZipArchivenow throws anException. A subclass can override__serialize()and__unserialize()to round-trip throughZipArchive::closeString()andZipArchive::openString().
Zlib
-
deflate_init()now raises aTypeErrorwhen the value for option"level","memory","window", or"strategy"is not of type int. -
inflate_init()now raises aTypeErrorwhen the value for option"window"is not of type int.
SAPI changes
CLI
- The built-in development server now accepts requests using the HTTP
QUERYmethod instead of returning 501 Not Implemented. - The built-in development server no longer reflects the
Hostheader from requests.
Windows support
- The official Windows builds now use Visual Studio 2026 (VS18).
- The libxml2 library used by the official Windows builds has been upgraded to version 2.15.3. As a result,
DOMDocument::$documentURIfor documents loaded from a local file now contains a native filesystem path instead of a file URI. - The OpenSSL library used by the official Windows builds has been upgraded to OpenSSL 4.
Extension changes
BZ2
- Deprecations
- Passing an object for the Bzip2 {de}compression stream filter is now deprecated. Use
get_object_vars()on the object instead. RFC: https://wiki.php.net/rfc/deprecations_php_8_6#passing_objects_as_parameters_to_the_bzip2decompress_and_bzip2compress_stream_filters
- Passing an object for the Bzip2 {de}compression stream filter is now deprecated. Use
COM
- BC breaks
- It is no longer possible to clone
variantobjects because the cloning behavior was ill-defined.
- It is no longer possible to clone
Curl
- New global constants
-
CURLINFO_SIZE_DELIVERED(libcurl >= 8.20.0). -
CURLOPT_SEEKFUNCTION. -
CURL_SEEKFUNC_OK. -
CURL_SEEKFUNC_FAIL. -
CURL_SEEKFUNC_CANTSEEK. -
CURL_READFUNC_ABORT.
-
- Other changes
-
curl_getinfo()return array now includes a newsize_deliveredkey, which indicates the total number of bytes passed to the download write callback. This value can also be obtained by passingCURLINFO_SIZE_DELIVEREDas the$optionparameter. Requires libcurl 8.20.0 or later. - Added
CURLOPT_SEEKFUNCTIONto register a callback that repositions a streamed request body so libcurl can rewind and resend it on a redirect, multi-pass authentication, or a retried reused connection instead of failing withCURLE_SEND_FAIL_REWIND. The callback receives theCurlHandle, offset and origin, and must return one ofCURL_SEEKFUNC_OK,CURL_SEEKFUNC_FAILorCURL_SEEKFUNC_CANTSEEK.
-
Date
- New classes
-
Time\Duration. RFC: https://wiki.php.net/rfc/duration_class -
Time\TimeException. RFC: https://wiki.php.net/rfc/duration_class
-
- Other changes
- The following methods now have tentative
staticreturn types:DateTime::createFromInterface(),DateTimeImmutable::__set_state(),DateTimeImmutable::modify(),DateTimeImmutable::add(),DateTimeImmutable::sub(),DateTimeImmutable::setTimezone(),DateTimeImmutable::setTime(),DateTimeImmutable::setDate(),DateTimeImmutable::setISODate(),DateTimeImmutable::setTimestamp(),DateTimeImmutable::createFromInterface(),DateTimeZone::__set_state(),DateInterval::__set_state(),DatePeriod::__set_state().
- The following methods now have tentative
DOM
- BC breaks
- Properties previously documented as
@readonly(e.g.DOMNode::$nodeType,DOMDocument::$xmlEncoding,DOMEntity::$actualEncoding,DOMEntity::$encoding,DOMEntity::$version) are now declared with asymmetric visibility (public private(set)). Attempts to write to them from outside the class now raise "Cannot modify private(set) property" instead of the prior readonly modification error.ReflectionProperty::isWritable()also reports these properties accurately. - Array access on
Dom\DtdNamedNodeMapobjects now returnsnullfor negative integer indexes instead of returning the first node.
- Properties previously documented as
Fileinfo
- Other changes
-
finfo_file()now works with remote streams. - Upgraded to file 5.48. Custom compiled magic databases from older file versions must be regenerated.
-
Filter
- Other changes
-
filter_var_array()return type has been narrowed fromarray|false|nulltoarray|false.filter_input_array()is unaffected: it still returnsnullwhen the requested superglobal does not exist.
-
GMP
- Deprecations
- The shift (
<<,>>) and exponentiation (**) operators on GMP objects now emit a deprecation warning when converting a float right operand to int loses precision.
- The shift (
- New functions
-
gmp_powm_sec()for side-channel quiet modular exponentiation. Requires GNU MP 5.0.0 or later; it is not available on official Windows builds using MPIR. -
gmp_prevprime()to get the largest prime smaller than the given number. The optional$definitely_primeoutput parameter indicates whether the returned number is definitely prime, as opposed to probably prime. AValueErroris thrown if no such prime exists. Requires GNU MP 6.3.0 or later; it is not available on official Windows builds using MPIR.
-
Hash
- Other changes
- The bundled version of xxHash was upgraded to 0.8.2.
Intl
- BC breaks
-
IntlIterator::current()now returnsnullwhen called before the iterator is positioned, or after the iterator becomes invalid, instead of exposing an undefined value. -
MessageFormatter::parse()andMessageFormatter::parseMessage()now returnPHP_INT_MINas int, rather than float, on 64-bit platforms when parsing integer values. - The
$typeparameter ofIntlBreakIterator::getPartsIterator()has been changed from string to int to match the underlying implementation. -
ResourceBundle::get()andresourcebundle_get()now report fallback-disabled resource lookups with "without fallback to " instead of the malformed "without fallback from to ".
-
- New classes
-
IntlNumberRangeFormatterto format an interval of two numbers with a given skeleton, locale,IntlNumberRangeFormatter::COLLAPSE_*collapse andIntlNumberRangeFormatter::IDENTITY_FALLBACK_*identity fallbacks. It is supported as of ICU 63.
-
- New functions
-
grapheme_strrev(). RFC: https://wiki.php.net/rfc/grapheme_strrev -
IntlDatePatternGenerator::getSkeleton()(static) -
IntlDatePatternGenerator::getBaseSkeleton()(static) -
Locale::getDisplayKeyword()/locale_get_display_keyword(). RFC: https://wiki.php.net/rfc/getdisplaykeyword_and_getdisplaykeywordvalue -
Locale::getDisplayKeywordValue()/locale_get_display_keyword_value(). RFC: https://wiki.php.net/rfc/getdisplaykeyword_and_getdisplaykeywordvalue -
SpoofChecker::areBidiConfusable()to check whether two strings are confusable for a given text direction. Supported as of ICU 74. -
SpoofChecker::getBidiSkeleton()to generate a confusable skeleton for a given text direction. Supported as of ICU 74. -
SpoofChecker::getSkeleton()to generate a confusable skeleton for a given string.
-
- New class constants
-
SpoofChecker::LTRandSpoofChecker::RTL.
-
JSON
- Other changes
- Added extra info about error location to the JSON error messages returned from
json_last_error_msg()and theJsonExceptionmessage.
- Added extra info about error location to the JSON error messages returned from
LDAP
- Other changes
-
ldap_free_result()return type has been narrowed frombooltotrue.
-
MBstring
- BC breaks
- Unicode data tables have been updated to Unicode 18.0.
- Deprecations
- Mbregex has been deprecated, because the underlying Oniguruma library is no longer maintained. RFC: https://wiki.php.net/rfc/eol-oniguruma
- Passing objects to
mb_convert_variables()is now deprecated. RFC: https://wiki.php.net/rfc/deprecations_php_8_6#passing_objects_for_vars_parameter_of_mb_convert_variables
- INI changes
- The
mbstring.detect_orderINI directive now updates the internal detection order when changed at runtime viaini_set(). Setting the directive toNULLor an empty string at runtime now leaves the previously configured detection order unchanged.
- The
MySQLi
- Deprecations
- The
mysqli_get_charset()function andmysqli::get_charset()method are now deprecated. RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_mysqli_get_charset - The
mysqli_stmt_init()function,mysqli::stmt_init()method, and calling themysqli_stmtconstructor without providing the$queryparameter are now deprecated. RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_mysqlistmt_init
- The
- INI changes
-
mysqli.default_portnow checks the validity of the value which should be between 0 and 65535 inclusive.
-
- New functions
-
mysqli::quote_string()/mysqli_quote_string(). RFC: https://wiki.php.net/rfc/mysqli_quote_string Documentation for mysqli::quote_string (PHP 8.6) #5908
-
- New global constants
-
MYSQLI_OPT_COMPRESS.
-
- Other changes
- The return structure of
mysqli_get_charset()no longer contains the undocumented"comment"element. The value of"charsetnr"is now set to a constant0.
- The return structure of
Opcache
- INI changes
-
opcache.jit_debugaccepts a new flag:ZEND_JIT_DEBUG_TRACE_EXIT_INFO_SRC. When used along withZEND_JIT_DEBUG_TRACE_EXIT_INFO, the source of exit points is printed in exit info output, in debug builds.
-
- Other changes
- JIT is now supported for ZTS builds on Apple Silicon.
OpenSSL
- New classes
-
Openssl\OpensslException -
Openssl\Session. RFC: https://wiki.php.net/rfc/tls_session_resumption -
Openssl\Psk
-
- New global constants
-
OPENSSL_RSA_PSS_SALTLEN_DIGEST. -
OPENSSL_RSA_PSS_SALTLEN_AUTO. -
OPENSSL_RSA_PSS_SALTLEN_MAX.
-
- Other changes
- Added TLS session resumption support for streams with new stream context options:
session_data,session_new_cb,session_cache,session_cache_size,session_timeout,session_id_context,session_get_cb,session_remove_cb, andnum_tickets. RFC: https://wiki.php.net/rfc/tls_session_resumption - Added TLS external PSK support for streams with new stream context options:
psk_client_cbandpsk_server_cb. - Added TLS 1.3 early data (0-RTT) support for streams. Clients send early data with the
early_datacontext option; servers accept it withmax_early_dataand receive it through theearly_data_cbcallback. The outcome is reported as'accepted','rejected'or'not_sent'in theearly_datakey of the cryptostream_get_meta_data()array. - Output of
openssl_x509_parse()containscriticalExtensionslisting all critical certificate extensions. -
openssl_sign()andopenssl_verify()now have an additional optional argument$salt_lengththat allows controlling the RSA-PSS salt length whenOPENSSL_PKCS1_PSS_PADDINGis used. It accepts an explicit length or one of the newOPENSSL_RSA_PSS_SALTLEN_*constants.
- Added TLS session resumption support for streams with new stream context options:
PCRE
- BC breaks
-
preg_grep()now returnsfalseinstead of a partial array when a PCRE execution error occurs (e.g. malformed UTF-8 input with the/umodifier). This is consistent with otherpreg_*functions.
-
PDO_DBLIB
- Other changes
- When using persistent connections, there is now a liveness check in the constructor.
PDO_PGSQL
- New class constants
-
Pdo\Pgsql::ATTR_CHUNK_SIZE, the number of rows a statement fetches per chunk. A value of 1 or more enters the lazy fetch mode ofPDO::ATTR_PREFETCH => 0. SettingPDO::ATTR_PREFETCHreplaces the chunk size. Statements that are prepared with neither it norPDO::ATTR_PREFETCHfall back to the value set on the connection. Requires libpq 17 or later.
-
Phar
- BC breaks
-
Phar::addEmptyDir()now treats non-magic names that merely share the".phar"prefix as ordinary directories. - Files are only automatically interpreted as Phar archives when included if
".phar"occurs as an extension in the filename component of their paths. Previously, it could occur in a directory name or as part of an extension such as".pharma".
-
- Other changes
- Overriding the
getMTime()andgetPathname()methods ofSplFileInfonow influences the result of the pharbuildFromfamily of functions. This makes it possible to override the timestamp and names of files. -
Phar::mungServer()now supports reference values.
- Overriding the
Readline
- Other changes
-
readline_completion_function()now declarestrueas its return type.
-
Reflection
- Deprecations
- Calling
ReflectionProperty::setValue()with an object that is not an instance of the class on which the property was declared is now deprecated. RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_reflectionpropertysetvalue_and_reflectionpropertysetrawvalue_with_wrong_types - Calling
ReflectionProperty::setRawValue()with an object that is not an instance of the class on which the property was declared is now deprecated. RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_reflectionpropertysetvalue_and_reflectionpropertysetrawvalue_with_wrong_types - Calling
ReflectionMethod::invoke()orReflectionMethod::invokeArgs()with an object and a static method is now deprecated. RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_reflectionmethodinvoke_and_reflectionmethodinvokeargs_with_objects_for_static_methods
- Calling
- New functions
-
ReflectionConstant::inNamespace() -
ReflectionProperty::isReadable(). RFC: https://wiki.php.net/rfc/isreadable-iswriteable -
ReflectionProperty::isWritable(). RFC: https://wiki.php.net/rfc/isreadable-iswriteable -
ReflectionParameter::getDocComment(). RFC: https://wiki.php.net/rfc/parameter-doccomments -
ReflectionAttribute::inNamespace() -
ReflectionAttribute::getNamespaceName() -
ReflectionAttribute::getShortName()
-
- Other changes
- The outputs of
ReflectionClassConstant::__toString()andReflectionConstant::__toString()for constants with boolean values have been changed to usetrueandfalserather than1and an empty string. This also affects other ways of printing class constants, e.g.ReflectionClass::__toString().
- The outputs of
Session
- BC breaks
-
session_encode()now returns an empty string instead offalsefor empty sessions. It only returnsfalsenow when the session data could not be encoded (mainly with the default serialization handler if a key contains the pipe|character). - When
session.lazy_writeis enabled and a session handler implementsSessionUpdateTimestampHandlerInterface, sessions that were read as empty and remain empty at write time will now triggerupdateTimestamp()instead ofwrite(). Custom session handlers that rely onwrite()being called with empty data (e.g. to destroy the session) should implement the same logic in theirupdateTimestamp()method. -
SessionHandler::validateId()has been added and delegates to the configured save handler. A subclass that declaresvalidateId()without a return type now emits a deprecation notice for the tentativeboolreturn type. A subclass that overridesopen()without callingparent::open()keeps its previous behavior and emits a warning when an ID is validated.
-
- INI changes (RFC: https://wiki.php.net/rfc/session_security_defaults)
-
session.use_strict_modedefault is now1(was0). Custom session handlers that previously relied on accepting externally supplied IDs without a corresponding storage entry must either implementvalidateId()/create_sid()or explicitly set this to0. -
session.cookie_httponlydefault is now1(was0). Applications that read the session cookie from JavaScript must explicitly set this to0. -
session.cookie_samesitedefault is now"Lax"(was unset). Applications that depend on session cookies being sent on cross-site POST submissions must explicitly set this to"None"(and also setsession.cookie_secureto1).
-
- New functions
-
SessionHandler::validateId()
-
- Deprecations
- It is now deprecated to pass an object that does not implement the
create_sid()andvalidateId()methods tosession_set_save_handler(). RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_passing_a_sessionhandler_object_to_session_set_save_handler_which_does_not_contain_the_create_sid_and_validateid - A deprecation is now emitted when implementing
SessionHandlerInterfaceon a class which doesn't define thecreate_sid()orvalidateId()methods, as those will be moved fromSessionUpdateTimestampHandlerInterfaceandSessionIdInterfacetoSessionHandlerInterface. RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_passing_a_sessionhandler_object_to_session_set_save_handler_which_does_not_contain_the_create_sid_and_validateid
- It is now deprecated to pass an object that does not implement the
SNMP
- New classes
- enum
Snmp\Mib - enum
Snmp\OidOutput - enum
Snmp\Output - enum
Snmp\StringOutput
- enum
- New functions
-
snmp_init_mib()to reset the MIB tree. RFC: https://wiki.php.net/rfc/snmp_improvements_2026#allow_the_snmp_mib_to_be_reset -
snmp_set_mib_option(). RFC: https://wiki.php.net/rfc/snmp_improvements_2026#implement_more_mib_parsing_and_value_output_controls -
snmp_set_output_option() -
snmp_set_string_output_format() -
SNMP::setOidOutputFormat() -
SNMP::setStringOutputFormat()
-
- New properties
-
SNMP::$numeric_index,SNMP::$numeric_timeticks,SNMP::$extended_index,SNMP::$dont_print_units,SNMP::$escape_quotes,SNMP::$print_hex_text
-
- Other changes
- It is now possible to use AES192, AES192C, AES256, and AES256C as SNMPv3 security protocols if the underlying library supports them. RFC: https://wiki.php.net/rfc/snmp_improvements_2026#increase_the_number_of_snmpv3_security_protocols_supported
SOAP
- BC breaks
- The
"classmap"option ofSoapClientandSoapServernow rejects arrays containing integer keys. Previously, sparse integer-keyed and mixed-keyed arrays could be accepted. - WSDL/XML Schema parsing now rejects out-of-range integer values for occurrence constraints and integer restriction facets. Negative
minOccursandmaxOccursvalues are rejected as well. - SOAP encoding errors now report the affected type or failing operation in the error message instead of the generic "Encoding: Violation of encoding rules" message.
- The
Sockets
- BC breaks
-
socket_set_option()withSO_ATTACH_REUSEPORT_CBPFand a$valueof0now detaches the reuseport filter throughSO_DETACH_REUSEPORT_BPF. It previously usedSO_DETACH_BPF, which left the reuseport program attached.
-
- New global constants
-
TCP_USER_TIMEOUT(Linux only). -
AF_UNSPEC. -
EAI_BADFLAGS. -
EAI_NONAME. -
EAI_AGAIN. -
EAI_FAIL. -
EAI_NODATA. -
EAI_FAMILY. -
EAI_SOCKTYPE. -
EAI_SERVICE. -
EAI_ADDRFAMILY. -
EAI_SYSTEM. -
EAI_OVERFLOW. -
EAI_INPROGRESS. -
EAI_CANCELED. -
EAI_NOTCANCELED. -
EAI_ALLDONE. -
EAI_INTR. -
EAI_IDN_ENCODE. -
SO_DETACH_REUSEPORT_BPF(Linux only).
-
- Other changes
-
socket_addrinfo_lookup()now has an additional optional argument$error_codethat, when notnull, receives the error code on failure (one of theEAI_*constants). -
socket_cmsg_space()return type has been narrowed from?inttoint.
-
Sodium
- New functions
- IPCrypt
-
sodium_crypto_ipcrypt_keygen() -
sodium_crypto_ipcrypt_encrypt() -
sodium_crypto_ipcrypt_decrypt() -
sodium_crypto_ipcrypt_nd_keygen() -
sodium_crypto_ipcrypt_nd_encrypt() -
sodium_crypto_ipcrypt_nd_decrypt() -
sodium_crypto_ipcrypt_ndx_keygen() -
sodium_crypto_ipcrypt_ndx_encrypt() -
sodium_crypto_ipcrypt_ndx_decrypt() -
sodium_crypto_ipcrypt_pfx_keygen() -
sodium_crypto_ipcrypt_pfx_encrypt() -
sodium_crypto_ipcrypt_pfx_decrypt() -
sodium_bin2ip() -
sodium_ip2bin()
-
- XOF
-
sodium_crypto_xof_shake128() -
sodium_crypto_xof_shake128_init() -
sodium_crypto_xof_shake128_update() -
sodium_crypto_xof_shake128_squeeze() -
sodium_crypto_xof_shake256() -
sodium_crypto_xof_shake256_init() -
sodium_crypto_xof_shake256_update() -
sodium_crypto_xof_shake256_squeeze() -
sodium_crypto_xof_turboshake128() -
sodium_crypto_xof_turboshake128_init() -
sodium_crypto_xof_turboshake128_update() -
sodium_crypto_xof_turboshake128_squeeze() -
sodium_crypto_xof_turboshake256() -
sodium_crypto_xof_turboshake256_init() -
sodium_crypto_xof_turboshake256_update() -
sodium_crypto_xof_turboshake256_squeeze()
-
- X-Wing KEM (hybrid ML-KEM768+X25519, libsodium >= 1.0.22)
-
sodium_crypto_kem_keypair() -
sodium_crypto_kem_seed_keypair() -
sodium_crypto_kem_secretkey() -
sodium_crypto_kem_publickey() -
sodium_crypto_kem_enc() -
sodium_crypto_kem_dec()
-
- ML-KEM768 (FIPS 203) KEM (libsodium >= 1.0.22)
-
sodium_crypto_kem_mlkem768_keypair() -
sodium_crypto_kem_mlkem768_seed_keypair() -
sodium_crypto_kem_mlkem768_secretkey() -
sodium_crypto_kem_mlkem768_publickey() -
sodium_crypto_kem_mlkem768_enc() -
sodium_crypto_kem_mlkem768_dec()
-
- IPCrypt
- New global constants
-
SODIUM_CRYPTO_IPCRYPT_BYTES -
SODIUM_CRYPTO_IPCRYPT_KEYBYTES -
SODIUM_CRYPTO_IPCRYPT_ND_KEYBYTES -
SODIUM_CRYPTO_IPCRYPT_ND_TWEAKBYTES -
SODIUM_CRYPTO_IPCRYPT_ND_INPUTBYTES -
SODIUM_CRYPTO_IPCRYPT_ND_OUTPUTBYTES -
SODIUM_CRYPTO_IPCRYPT_NDX_KEYBYTES -
SODIUM_CRYPTO_IPCRYPT_NDX_TWEAKBYTES -
SODIUM_CRYPTO_IPCRYPT_NDX_INPUTBYTES -
SODIUM_CRYPTO_IPCRYPT_NDX_OUTPUTBYTES -
SODIUM_CRYPTO_IPCRYPT_PFX_KEYBYTES -
SODIUM_CRYPTO_IPCRYPT_PFX_BYTES -
SODIUM_CRYPTO_XOF_SHAKE128_BLOCKBYTES -
SODIUM_CRYPTO_XOF_SHAKE128_STATEBYTES -
SODIUM_CRYPTO_XOF_SHAKE256_BLOCKBYTES -
SODIUM_CRYPTO_XOF_SHAKE256_STATEBYTES -
SODIUM_CRYPTO_XOF_TURBOSHAKE128_BLOCKBYTES -
SODIUM_CRYPTO_XOF_TURBOSHAKE128_STATEBYTES -
SODIUM_CRYPTO_XOF_TURBOSHAKE256_BLOCKBYTES -
SODIUM_CRYPTO_XOF_TURBOSHAKE256_STATEBYTES -
SODIUM_CRYPTO_KEM_PUBLICKEYBYTES(libsodium >= 1.0.22) -
SODIUM_CRYPTO_KEM_SECRETKEYBYTES(libsodium >= 1.0.22) -
SODIUM_CRYPTO_KEM_CIPHERTEXTBYTES(libsodium >= 1.0.22) -
SODIUM_CRYPTO_KEM_SHAREDSECRETBYTES(libsodium >= 1.0.22) -
SODIUM_CRYPTO_KEM_SEEDBYTES(libsodium >= 1.0.22) -
SODIUM_CRYPTO_KEM_KEYPAIRBYTES(libsodium >= 1.0.22) -
SODIUM_CRYPTO_KEM_MLKEM768_PUBLICKEYBYTES(libsodium >= 1.0.22) -
SODIUM_CRYPTO_KEM_MLKEM768_SECRETKEYBYTES(libsodium >= 1.0.22) -
SODIUM_CRYPTO_KEM_MLKEM768_CIPHERTEXTBYTES(libsodium >= 1.0.22) -
SODIUM_CRYPTO_KEM_MLKEM768_SHAREDSECRETBYTES(libsodium >= 1.0.22) -
SODIUM_CRYPTO_KEM_MLKEM768_SEEDBYTES(libsodium >= 1.0.22) -
SODIUM_CRYPTO_KEM_MLKEM768_KEYPAIRBYTES(libsodium >= 1.0.22)
-
SPL
- BC breaks
-
SplFileObject::next()now advances the stream when no priorcurrent()call has cached a line. A subsequentcurrent()call returns the new line rather than the previous one. -
SplFileObject::fgets()no longer caches the returned line for subsequentcurrent()calls.current()now re-reads from the current stream position instead of returning the linefgets()just returned. -
SplFileObject::next()past EOF no longer incrementskey()without bound.SplFileObject::seek()past EOF now produces the samekey()value asSplTempFileObject; the two previously returned different values. -
DirectoryIterator::key()now returnsint|string, andDirectoryIterator::current()returnsstring|SplFileInfo|static.
-
- Deprecations
- The
spl_classes()function is now deprecated. UseReflectionExtension::getClassNames()instead. RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_spl_classes - The
spl_object_hash()function is now deprecated. Usespl_object_id()instead. RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_spl_object_hash - The following
ArrayIteratormethods are now deprecated. RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_arrayiterator_methods_that_inherit_arrayobject_implementation-
ArrayIterator::getFlags() -
ArrayIterator::setFlags() -
ArrayIterator::asort() -
ArrayIterator::ksort() -
ArrayIterator::uasort() -
ArrayIterator::uksort() -
ArrayIterator::natsort() -
ArrayIterator::natcasesort() -
ArrayIterator::unserialize() -
ArrayIterator::serialize()
-
- The following
SplFileObjectmethods are now deprecated. RFC: https://wiki.php.net/rfc/deprecations_php_8_6#deprecate_splfileobject_csv_methods-
SplFileObject::fgetcsv() -
SplFileObject::fputcsv() -
SplFileObject::setCsvControl() -
SplFileObject::getCsvControl()
-
- The
URI
- BC breaks
-
Uri\WhatWg\Url::__construct()now sets$softErrorsto an empty array when URL processing throws an exception, instead of preserving its value. URL validation errors remain available in theUri\WhatWg\InvalidUrlException::$errorsproperty.
-
- New classes
-
Uri\Rfc3986\UriBuilder. RFC: https://wiki.php.net/rfc/uri_followup#uri_building -
Uri\WhatWg\UrlBuilder. RFC: https://wiki.php.net/rfc/uri_followup#uri_building - enum
Uri\WhatWg\UrlPercentEncodingMode. RFC: https://wiki.php.net/rfc/uri_followup#percent-encoding_support
-
- New functions
-
Uri\Rfc3986\Uri::getUriType(). RFC: https://wiki.php.net/rfc/uri_followup#uri_type_detection -
Uri\WhatWg\Url::isSpecialScheme(). RFC: https://wiki.php.net/rfc/uri_followup#uri_type_detection -
Uri\Rfc3986\Uri::getHostType(). RFC: https://wiki.php.net/rfc/uri_followup#host_type_detection -
Uri\WhatWg\Url::getHostType(). RFC: https://wiki.php.net/rfc/uri_followup#host_type_detection -
Uri\WhatWg\url_percent_encode(). RFC: https://wiki.php.net/rfc/uri_followup#percent-encoding_support
-
Zip
- New functions
-
ZipArchive::openString() -
ZipArchive::closeString()
-
- Other changes
-
zip_entry_close()return type has been narrowed frombooltotrue.
-
Zlib
- Deprecations
- Passing an object for the zlib deflate and inflate stream filter is now deprecated. Use
get_object_vars()on the object instead. RFC: https://wiki.php.net/rfc/deprecations_php_8_6#passing_objects_as_parameters_to_the_zlibinflate_and_zlibdeflate_stream_filters - Passing an object as the
$optionargument todeflate_init()andinflate_init()is now deprecated. Useget_object_vars()on the object instead. RFC: https://wiki.php.net/rfc/deprecations_php_8_6#passing_objects_for_options_parameter_of_deflate_init_and_inflate_init
- Passing an object for the zlib deflate and inflate stream filter is now deprecated. Use
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity