PHP 8.5.0 更新日志
PHP 8.5.0 于 2025 年 11 月 20 日发布,是 PHP 8.5 分支的首个正式版本,带来语言层、核心运行时、扩展 API、标准库和多项扩展能力更新。
- 语言与核心:新增 #[NoDiscard] 属性、(void) cast、get_error_handler()、get_exception_handler()、常量表达式中的 cast、Closure 和 first class callable、pipe 操作符、final 构造器属性提升、DelayedTargetValidation 属性、PHP_BUILD_PROVIDER、PHP_BUILD_DATE、fatal error backtrace,以及 clone() 的 clone-with 支持。
- URL 与 URI:加入 RFC 3986 和 WHATWG URL 兼容的解析与操作 API,新增 URI 扩展,并支持为 FTP/FTPS、SSL/TLS stream wrapper、FILTER_VALIDATE_URL 和 SoapClient::__doRequest() 配置 URI parser。
- CLI、Curl、DOM、EXIF:CLI 新增 --ini=diff 并移除 -z 旗标;Curl 增加 follow location 选项、multi handles、persistent share、更多 getinfo 信息和 SSL signature algorithms;DOM 增加 outerHTML、insertAdjacentHTML、children、getElementsByClassName 等;EXIF 增加 OffsetTime 标签和 HEIF 读取支持。
- 数据库与网络:PGSQL 增加 pg_close_stmt、copy_from Iterable、pg_service 等;PDO/SQLite 增强 explain、fetchAll、busy 等能力;Sockets 增加 ICMP、FreeBSD TCP、UDP_SEGMENT、socket_shutdown 常量和更多参数校验。
- Reflection、Session、Standard:Reflection 增加常量扩展信息、属性 mangled name 等能力;Session 支持 partitioned cookies;Standard 增加 HEIF/HEIC 和 SVG getimagesize 支持、array_first()、array_last()、mail.cr_lf_mode,并改进 html_entity_decode、pack、array_chunk 等性能。
- 兼容性与弃用:弃用 report_memleaks、非数值字符串自增、部分 closure binding、常量重定义、从 query string 派生 argc/argv、null array offset、$http_response_header、非规范 cast 名称、backtick 操作符、xml_parser_free()、curl_close()、curl_share_close() 等;移除 disable_classes INI 指令。
- 修复与稳定性:包含 Core、BCMath、Bz2、COM、Date、DOM、FPM、GD、MbString、Opcache、OpenSSL、Phar、Reflection、SOAP、SPL、Standard、Streams、Tidy、Tokenizer、Windows、XMLWriter、XSL、Zlib、Zip 等大量崩溃、泄漏、边界行为、构建和安全相关修复。
