Added the pipe
(|>) operator.
<?php
$result = "Hello World" |> strlen(...);
print $result . PHP_EOL; // Prints "11"Added support for Closures and first class callables in constant expressions. This includes:
Added the NoDiscard attribute to indicate that a function's return value is important and should be consumed.
Also, added the (void) cast to indicate that not using a value is intentional.
The (void) cast has no effect on the program's execution by itself, but
it can be used to suppress warnings emitted by #[\NoDiscard] and possibly
also diagnostics emitted by external IDEs or static analysis tools.
<?php
#[\NoDiscard]
function concat(string $a, string $b): string {
return a + b;
}
// Warning: The return value of function concat() should either be used or
// intentionally ignored by casting it as (void) in xxx.php
concat("a", "b");
// No warning, because the return value is consumed by the assignment.
$results = concat("a", "b");
// No warning, because the (void) cast is used.
(void)concat("a", "b");
Added support for attributes on compile-time non-class constants
(e.g. const MY_CONST = 1; rather than
define('MY_CONST', 1);).
The Deprecated attribute can now be used on constants.
#[\DelayedTargetValidation] attributeThe new DelayedTargetValidation attribute can be used to suppress compile-time errors from core (or extension) attributes that are used on invalid targets. These errors are instead reported at runtime if and when ReflectionAttribute::newInstance() is called.
#[\Override] for propertiesOverride attribute can now be applied to properties.
Added asymmetric visibility support for static properties.
Fatal Errors (such as an exceeded maximum execution time) now include a backtrace.
Constructor property promotion can now be used for final properties.
Added support for casts in constant expressions.
<?php
const T1 = (int) 0.3; // Previously: "Fatal error: Constant expression contains invalid operations"
print T1 . PHP_EOL; // Prints "0"The clone language construct is now a function and supports reassigning (readonly) properties during cloning via the new $withProperties parameter.
Added support for share handles that are persisted across multiple PHP requests, safely allowing for more effective connection reuse.
Added support for CURLINFO_USED_PROXY (libcurl >= 8.7.0),
CURLINFO_HTTPAUTH_USED,
and CURLINFO_PROXYAUTH_USED (libcurl >= 8.12.0)
to the curl_getinfo() function.
When curl_getinfo() returns an array, the same information
is available as "used_proxy",
"httpauth_used", and "proxyauth_used"
keys.
CURLINFO_USED_PROXY gets zero set if no proxy was used in the
previous transfer or a non-zero value if a proxy was used.
CURLINFO_HTTPAUTH_USED and
CURLINFO_PROXYAUTH_USED get bitmasks
indicating the HTTP and proxy authentication methods that were
used in the previous request.
See CURLAUTH_* constants for
possible values.
Added CURLOPT_INFILESIZE_LARGE Curl option, which is a safe
replacement for CURLOPT_INFILESIZE. On certain systems,
CURLOPT_INFILESIZE only accepts a 32-bit signed integer as
the file size (2.0 GiB) even on 64-bit systems.
CURLOPT_INFILESIZE_LARGE accepts the largest integer value
the system can handle.
Added CURLFOLLOW_OBEYCODE,
CURLFOLLOW_FIRSTONLY and CURLFOLLOW_ALL
values for CURLOPT_FOLLOWLOCATION
curl_setopt() option.
CURLFOLLOW_OBEYCODE to follow more strictly in regard to
redirect if they are allowed.
CURLFOLLOW_FIRSTONLY to follow only the first redirect thus
if there is any follow up redirect, it won't go any further.
CURLFOLLOW_ALL is equivalent to setting
CURLOPT_FOLLOWLOCATION to true.
Added support for CURLINFO_CONN_ID (libcurl >= 8.2.0)
to the curl_getinfo() function. This constant allows retrieving
the unique ID of the connection used by a cURL transfer. It is primarily
useful when connection reuse or connection pooling logic is needed in
PHP-level applications. When curl_getinfo() returns an array,
this value is available as the "conn_id" key.
Added support for CURLINFO_QUEUE_TIME_T (libcurl >= 8.6.0)
to the curl_getinfo() function. This constant allows
retrieving the time (in microseconds) that the request spent in libcurl’s
connection queue before it was sent.
This value can also be retrieved by passing
CURLINFO_QUEUE_TIME_T to the curl_getinfo()
option parameter.
Added support for CURLOPT_SSL_SIGNATURE_ALGORITHMS to
specify the signature algorithms to use for TLS.
Added support for OffsetTime* Exif tags.
Added support for HEIF/HEIC.
Added new FILTER_THROW_ON_FAILURE flag which can be
passed to the filter functions and will force an exception to be triggered
when validation fails.
The new flag cannot be combined with
FILTER_NULL_ON_FAILURE; trying to do so will result
in a ValueError being thrown.
Added class constants NumberFormatter::CURRENCY_ISO,
NumberFormatter::CURRENCY_PLURAL,
NumberFormatter::CASH_CURRENCY,
and NumberFormatter::CURRENCY_STANDARD
for various currency-related number formats.
Added Locale::addLikelySubtags() and Locale::minimizeSubtags() to handle likely tags on a given locale.
Added IntlListFormatter class to format, order,
and punctuate a list of items with a given locale,
IntlListFormatter::TYPE_AND,
IntlListFormatter::TYPE_OR,
IntlListFormatter::TYPE_UNITS operands and
IntlListFormatter::WIDTH_WIDE,
IntlListFormatter::WIDTH_SHORT and
IntlListFormatter::WIDTH_NARROW widths.
It is supported from icu 67.
Added class constant Pdo\Sqlite::ATTR_BUSY_STATEMENT.
Added class constants Pdo\Sqlite::ATTR_EXPLAIN_STATEMENT,
Pdo\Sqlite::EXPLAIN_MODE_PREPARED,
Pdo\Sqlite::EXPLAIN_MODE_EXPLAIN,
Pdo\Sqlite::EXPLAIN_MODE_EXPLAIN_QUERY_PLAN.
Added Pdo\Sqlite::ATTR_TRANSACTION_MODE connection attribute
with possible values Pdo\Sqlite::TRANSACTION_MODE_DEFERRED,
Pdo\Sqlite::TRANSACTION_MODE_IMMEDIATE,
and Pdo\Sqlite::TRANSACTION_MODE_EXCLUSIVE,
allowing to configure the transaction mode to use when calling beginTransaction().
session_set_cookie_params(),
session_get_cookie_params(),
and session_start() now support partitioned cookies via the
"partitioned" key.
Enumeration cases are now dumped in SoapClient::__getTypes().
Added support for Soap 1.2 Reason Text xml:lang attribute.
The signature of SoapFault::__construct() and
SoapServer::fault() therefore
now have an optional $lang parameter.
This support solves compatibility with .NET SOAP clients.
mail() now returns the actual sendmail error and detects if the sendmail process was terminated unexpectedly. In such cases, a warning is emitted and the function returns false. Previously, these errors were silently ignored. This change affects only the sendmail transport.
getimagesize() now supports HEIF/HEIC images.
getimagesize() now supports SVG images when ext-libxml is also loaded. Similarly, image_type_to_extension() and image_type_to_mime_type() now also handle IMAGETYPE_SVG.
The array returned by getimagesize() now has two additional entries:
"width_unit" and "height_unit" to indicate in
which units the dimensions are expressed. These units are px by default. They are not
necessarily the same (just to give one example: one may be cm and the other may be px).
setcookie() and setrawcookie() now support the
"partitioned" key.
An always enabled uri extension is added that can be used for handling URIs and URLs according to RFC 3986 and WHATWG URL.
The $namespace argument of XSLTProcessor::getParameter(),
XSLTProcessor::setParameter() and
XSLTProcessor::removeParameter() now actually works
instead of being treated as empty.
This only works if the $name argument does not use Clark notation and is not a
QName because in those cases the namespace is taken from the namespace href or
prefix respectively.
flock() is now supported on zlib streams. Previously, this always failed to perform any locking action.