新功能

PHP 核心

属性钩子

TODO

<?php
/*
examples
*/

不对称属性可见性

现在可以将对象属性的 set 可见性和 get 可见性分开控制。

<?php
class Example
{
public protected(
set) string $name;

public function
__construct(string $name)
{
$this->name = $name;
}
}

Lazy Objects

TODO

#[\Deprecated] 注解

TODO

在非 POST HTTP 请求中解析 RFC1867(multipart)请求

添加 request_parse_body() 函数允许在非 POST HTTP 请求中解析 RFC1867(multipart)请求。

链接 new 表达式不再需要括号

具有构造函数参数的新表达式现在可解除引用(dereferencable),这意味着无需将表达式括在括号中,可以直接链接方法调用、属性访问等。

改进了 WeakReference 的调试信息

获取 WeakReference 的调试信息现在还会输出其引用的对象,如果引用不再有效,则输出 null

改进了 Closure 的调试信息

Closure::__debugInfo() 的输出现在包含 Closure 的名称、文件名、和行数。

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.

cURL

curl_version() 返回额外的 feature_list 值,是所有已知 CURL 功能的滚脸上数组,值是支持(true)或者不支持(false)。

Added CURL_HTTP_VERSION_3 and CURL_HTTP_VERSION_3ONLY constants (available since libcurl 7.66 and 7.88) as available options for CURLOPT_HTTP_VERSION.

Added CURLOPT_PREREQFUNCTION as a cURL option that accepts a callable to be called after the connection is made, but before the request is sent. This callable must return either CURL_PREREQFUNC_OK or CURL_PREREQFUNC_ABORT to allow or abort the request.

Added CURLOPT_SERVER_RESPONSE_TIMEOUT, which was formerly known as CURLOPT_FTP_RESPONSE_TIMEOUT. Both constants hold the same value.

Added CURLOPT_DEBUGFUNCTION as a cURL option that accepts a callable that gets called during the request lifetime with the CurlHandle object, an integer containing the debug message type, and a string containing the debug message. The debug message type is one of the following constants:

  • CURLINFO_TEXT
  • CURLINFO_HEADER_IN
  • CURLINFO_HEADER_OUT
  • CURLINFO_DATA_IN
  • CURLINFO_DATA_OUT
  • CURLINFO_SSL_DATA_IN
  • CURLINFO_SSL_DATA_OUT
Once this option is set, CURLINFO_HEADER_OUT must not be set because it uses the same libcurl functionality.

The curl_getinfo() now returns an additional posttransfer_time_us key, containing the number of microseconds from the start until the last byte is sent. When a redirect is followed, the time from each request is added together. This value can also be retrieved by passing CURLINFO_POSTTRANSFER_TIME_T to the curl_getinfo() option parameter. This requires libcurl 8.10.0 or later.

DOM

Added the DOMNode::compareDocumentPosition() with its associated constants:

  • DOMNode::DOCUMENT_POSITION_DISCONNECTED
  • DOMNode::DOCUMENT_POSITION_PRECEDING
  • DOMNode::DOCUMENT_POSITION_FOLLOWING
  • DOMNode::DOCUMENT_POSITION_CONTAINS
  • DOMNode::DOCUMENT_POSITION_CONTAINED_BY
  • DOMNode::DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC

It is now possible to pass any callable to DOMXPath::registerPhpFunctions().

FPM

Flushing headers without a body will now succeed.

状态页面新增字段用于展示内存峰值。

Intl

Added the NumberFormatter::ROUND_HALFODD to complement the existing NumberFormatter::ROUND_HALFEVEN functionality.

OpenSSL

Added support for Curve25519 + Curve448 based keys. Specifically x25519, ed25519, x448 and ed448 fields are supported in openssl_pkey_new(), openssl_pkey_get_details(), openssl_sign(), and openssl_verify() were extended to support those keys.

Implement PASSWORD_ARGON2 password hashing. Requires OpenSSL 3.2 and NTS build.

PCRE

The bundled pcre2lib has been updated to version 10.44. As a consequence, LoongArch JIT support has been added, spaces are now allowed between braces in Perl-compatible items, and variable-length lookbehind assertions are now supported.

With pcre2lib version 10.44, the maximum length of named capture groups has changed from 32 to 128.

Added support for the r (PCRE2_EXTRA_CASELESS_RESTRICT) modifier, as well as the (?r) mode modifier. When enabled along with the case-insensitive modifier (i), the expression locks out mixing of ASCII and non-ASCII characters.

PDO

Added support for driver-specific subclasses. This RFC adds subclasses for PDO in order to better support database-specific functionalities. The new classes are instantiatable either via calling the PDO::connect() method or by instantiating an instance of the driver-specific subclass directly.

Added support for driver specific SQL parsers. The default parser supports:

  • single and double-quoted literals, with doubling as escaping mechanism
  • two-dashes and non-nested C-style comments

PDO_MYSQL

Added a custom parser supporting:

  • single and double-quoted literals, with doubling and backslash as escaping mechanism
  • backtick literal identifiers and with doubling as escaping mechanism
  • two dashes followed by at least 1 whitespace, non-nested C-style comments, and hash-comments

PDO_PGSQL

Added a custom parser supporting:

  • single and double-quoted literals, with doubling as escaping mechanism
  • C-style "escape" string literals (E'string')
  • dollar-quoted string literals
  • two-dashes and C-style comments (non-nested)
  • support for ?? as escape sequence for the ? operator

PDO_SQLITE

Added a custom parser supporting:

  • single, double-quoted, and backtick literals, with doubling as escaping mechanism
  • square brackets quoting for identifiers
  • two-dashes and C-style comments (non-nested)

Phar

Added support for the Unix timestamp extension for Zip archives.

Readfile

Added ability to change the .php_history path through the PHP_HISTFILE environment variable.

Reflection

ReflectionAttribute now contains a name property to improve the debugging experience.

ReflectionClassConstant::__toString() and ReflectionProperty::__toString() now returns the attached doc comments.

Multiple new methods and constants which are related to the lazy objects feature have been added:

  • ReflectionClass::newLazyGhost()
  • ReflectionClass::newLazyProxy()
  • ReflectionClass::resetAsLazyGhost()
  • ReflectionClass::resetAsLazyProxy()
  • ReflectionClass::isUninitializedLazyObject()
  • ReflectionClass::initializeLazyObject()
  • ReflectionClass::markLazyObjectAsInitialized()
  • ReflectionClass::getLazyInitializer()
  • ReflectionClass::skipLazyInitialization()
  • ReflectionClass::setRawValueWithoutLazyInitialization()
  • ReflectionClass::SKIP_INITIALIZATION_ON_SERIALIZE
  • ReflectionClass::SKIP_DESTRUCTOR

SOAP

Added support for clark notation for namespaces in class map. It is now possible to specify entries in a class map with clark notation to resolve a type with a specific namespace to a specific class. For example: '{http://example.com}foo' => 'FooClass'.

Instances of DateTimeInterface that are passed to xsd:datetime or similar elements are now serialized as such instead of being serialized as an empty string.

Session persistence now works with a shared session module.

标准

Added a new RoundingMode enum with clearer naming and improved discoverability compared to the PHP_ROUND_* constants. Moreover, four new rounding modes were added which are only available via the new RoundingMode enum.

XSL

It is now possible to use parameters that contain both single and double quotes.

It is now possible to pass any callable to XSLTProcessor::registerPhpFunctions().

Added XSLTProcessor::$maxTemplateDepth and XSLTProcessor::$maxTemplateVars to control the recursion depth of XSL template evaluation.

Zip

Added the ZipArchive::ER_TRUNCATED_ZIP constant, which was added in libzip 1.11.

添加备注

用户贡献的备注

此页面尚无用户贡献的备注。
To Top