1PHP 8.5 UPGRADE NOTES 2 31. Backward Incompatible Changes 42. New Features 53. Changes in SAPI modules 64. Deprecated Functionality 75. Changed Functions 86. New Functions 97. New Classes and Interfaces 108. Removed Extensions and SAPIs 119. Other Changes to Extensions 1210. New Global Constants 1311. Changes to INI File Handling 1412. Windows Support 1513. Other Changes 1614. Performance Improvements 17 18======================================== 191. Backward Incompatible Changes 20======================================== 21 22- BZ2: 23 . bzcompress() now throws a ValueError when $block_size is not between 24 1 and 9. 25 . bzcompress() now throws a ValueError when $work_factor is not between 26 0 and 250. 27 28- Core: 29 . It is no longer possible to use "array" and "callable" as class alias names 30 in class_alias(). 31 . Loosely comparing uncomparable objects (e.g. enums, \CurlHandle and other 32 internal classes) to booleans was previously inconsistent. If compared to a 33 boolean literal $object == true, it would behave the same way as (bool) 34 $object. If compared to a statically unknown value $object == $true, it 35 would always return false. This behavior was consolidated to always follow 36 the behavior of (bool) $object. 37 . The return value of gc_collect_cycles() no longer includes strings and 38 resources that were indirectly collected through cycles. 39 40- Intl: 41 . The extension now requires at least ICU 57.1. 42 43- LDAP: 44 . ldap_get_option() and ldap_set_option() now throw a ValueError when 45 passing an invalid option. 46 47- PCNTL: 48 . pcntl_exec() now throws ValueErrors when entries of the $args parameter 49 contain null bytes. 50 . pcntl_exec() now throws ValueErrors when entries or keys of the 51 $env_vars parameter contain null bytes. 52 53- PDO: 54 . The constructor arguments set in conjunction with PDO::FETCH_CLASS now 55 follow the usual CUFA (call_user_func_array) semantics. 56 This means string keys will act like a named argument. 57 Moreover, automatic wrapping for by-value arguments passed to a by-ref 58 parameter has been removed, and the usual E_WARNING about this is now 59 emitted. 60 To pass a variable by-ref to a constructor argument use the general 61 array value reference assignment: $ctor_args = [&$valByRef] 62 . Attempting to modify a PDOStatement during a call to PDO::fetch(), 63 PDO::fetchObject(), PDO::fetchAll() will now throw an Error. 64 65- PDO_FIREBIRD: 66 . A ValueError is now thrown when trying to set a cursor name that is too 67 long on a PDOStatement resulting from the Firebird driver. 68 69- SPL: 70 . ArrayObject no longer accepts enums, as modifying the $name or $value 71 properties can break engine assumptions. 72 . SplFileObject::fwrite's parameter $length is now nullable. The default 73 value changed from 0 to null. 74 75======================================== 762. New Features 77======================================== 78 79- Core: 80 . Closure is now a proper subtype of callable 81 . Added support for Closures in constant expressions. 82 RFC: https://wiki.php.net/rfc/closures_in_const_expr 83 . Fatal Errors (such as an exceeded maximum execution time) now include a 84 backtrace. 85 RFC: https://wiki.php.net/rfc/error_backtraces_v2 86 87- Curl: 88 . Added support for share handles that are persisted across multiple PHP 89 requests, safely allowing for more effective connection reuse. 90 RFC: https://wiki.php.net/rfc/curl_share_persistence_improvement 91 92- DOM: 93 . Added Dom\Element::$outerHTML. 94 95- XSL: 96 . The $namespace argument of XSLTProcessor::getParameter(), 97 XSLTProcessor::setParameter() and XSLTProcessor::removeParameter() 98 now actually works instead of being treated as empty. 99 This only works if the $name argument does not use Clark notation 100 and is not a QName because in those cases the namespace is taken 101 from the namespace href or prefix respectively. 102 103======================================== 1043. Changes in SAPI modules 105======================================== 106 107- CLI: 108 . Trying to set a process title that is too long with cli_set_process_title() 109 will now fail instead of silently truncating the given title. 110 111======================================== 1124. Deprecated Functionality 113======================================== 114 115- Hash: 116 The MHASH_* constants have been deprecated. These have been overlooked 117 when the mhash*() function family has been deprecated per 118 https://wiki.php.net/rfc/deprecations_php_8_1#mhash_function_family 119 120======================================== 1215. Changed Functions 122======================================== 123 124- Intl: 125 . IntlDateFormatter::setTimeZone()/datefmt_set_timezone() 126 throws an IntlException on uninitialised classes/clone failures. 127 128 . grapheme_extract() properly assigns $next value when skipping over 129 invalid starting bytes. Previously there were cases where it would 130 point to the start of the grapheme boundary instead of the end. 131 132- PCNTL: 133 . pcntl_exec() now has a formal return type of false. 134 135- PDO_PGSQL: 136 . PDO::pgsqlCopyFromArray also supports inputs as Iterable. 137 . Pdo\Pgsql::setAttribute and Pdo\Pgsql::prepare supports 138 PDO::ATTR_PREFETCH sets to 0 which set to lazy fetch mode. 139 In this mode, statements cannot be run parallely. 140 141- PGSQL: 142 . pg_copy_from also supports inputs as Iterable. 143 . pg_connect checks if the connection_string argument contains 144 any null byte. 145 . pg_close_stmt checks if the statement_name argument contains 146 any null byte. 147 148- POSIX: 149 . posix_ttyname sets last_error to EBADF when encountering 150 an invalid file descriptor. 151 . posix_isatty raises an E_WARNING message when encountering 152 an invalid file descriptor. 153 . posix_fpathconf checks invalid file descriptors and sets 154 last_error to EBADF and raises an E_WARNING message. 155 156- Session: 157 . session_start is stricter in regard of the option argument. 158 it throws a ValueError if the whole is not a hashmap or 159 a TypeError if read_on_close value is not a valid type 160 compatible with int. 161 162- SNMP: 163 . snmpget, snmpset, snmp_get2, snmp_set2, snmp_get3, snmp_set3 164 and SNMP::__construct() throw a ValueError when the hostname 165 is too large, contains any null byte or if the port is given 166 when negative or greater than 65535, timeout and retries values 167 are lower than -1 or too large. 168 169- Sockets: 170 . socket_create_listen, socket_bind and socket_sendto throw a 171 ValueError if the port is lower than 0 or greater than 65535, 172 also if any of the hints array entry is indexes numerically. 173 . socket_addrinfo_lookup throw a TypeError if any of the hints 174 values cannot be cast to a int and can throw a ValueError if 175 any of these values overflow. 176 . socket_set_option with MCAST_LEAVE_GROUP/MCAST_LEAVE_SOURCE_GROUP 177 options will throw an exception if the value isn't a valid object 178 or array. 179 . socket_create/socket_bind can create AF_PACKET family sockets. 180 . socket_getsockname gets the interface index and its string 181 representation with AF_PACKET socket. 182 183- Zlib: 184 . The "use_include_path" argument for the 185 gzfile, gzopen and readgzfile functions had been changed 186 from int to boolean. 187 . gzfile, gzopen and readgzfile functions now respect the default 188 stream context. 189 190======================================== 1916. New Functions 192======================================== 193 194- Curl: 195 . curl_multi_get_handles() allows retrieving all CurlHandles current 196 attached to a CurlMultiHandle. This includes both handles added using 197 curl_multi_add_handle() and handles accepted by CURLMOPT_PUSHFUNCTION. 198 . curl_share_init_persistent() allows creating a share handle that is 199 persisted across multiple PHP requests. 200 RFC: https://wiki.php.net/rfc/curl_share_persistence_improvement 201 202- DOM: 203 . Added Dom\Element::insertAdjacentHTML(). 204 205- Enchant: 206 . Added enchant_dict_remove_from_session() to remove a word added to the 207 spellcheck session via enchant_dict_add_to_session(). 208 . Added enchant_dict_remove() to put a word on the exclusion list and 209 remove it from the session dictionary. 210 211- PGSQL: 212 . pg_close_stmt offers an alternative way to close a prepared 213 statement from the DEALLOCATE sql command in that we can reuse 214 its name afterwards. 215 216- Reflection: 217 . ReflectionConstant::getFileName() was introduced. 218 . ReflectionConstant::getExtension() and 219 ReflectionConstant::getExtensionName() were introduced. 220 221======================================== 2227. New Classes and Interfaces 223======================================== 224 225- Curl: 226 . CurlSharePersistentHandle representing a share handle that is persisted 227 across multiple PHP requests. 228 RFC: https://wiki.php.net/rfc/curl_share_persistence_improvement 229 230======================================== 2318. Removed Extensions and SAPIs 232======================================== 233 234======================================== 2359. Other Changes to Extensions 236======================================== 237 238- Readline: 239 . The return types of readline_add_history(), readline_clear_history(), and 240 readline_callback_handler_install() have been changed to true, rather 241 than bool. 242 243======================================== 24410. New Global Constants 245======================================== 246 247- Core: 248 . PHP_BUILD_DATE. 249 250- POSIX: 251 . POSIX_SC_OPEN_MAX. 252 253- Sockets: 254 . IPPROTO_ICMP/IPPROTO_ICMPV6. 255 . TCP_FUNCTION_BLK (FreeBSD only). 256 . TCP_FUNCTION_ALIAS (FreeBSD only). 257 . TCP_REUSPORT_LB_NUMA (FreeBSD only). 258 . TCP_REUSPORT_LB_NUMA_NODOM (FreeBSD only). 259 . TCP_REUSPORT_LB_NUMA_CURDOM (FreeBSD only). 260 . TCP_BBR_ALGORITHM (FreeBSD only). 261 . AF_PACKET (Linux only). 262 263======================================== 26411. Changes to INI File Handling 265======================================== 266 267- Core: 268 . Added fatal_error_backtraces to control whether fatal errors should include 269 a backtrace. 270 RFC: https://wiki.php.net/rfc/error_backtraces_v2 271 272- Opcache: 273 . Added opcache.file_cache_read_only to support a read-only 274 opcache.file_cache directory, for use with read-only file systems 275 (e.g. read-only Docker containers). 276 Best used with opcache.validate_timestamps=0, 277 opcache.enable_file_override=1, 278 and opcache.file_cache_consistency_checks=0. 279 Note: A cache generated with a different build of PHP, a different file 280 path, or different settings (including which extensions are loaded), may be 281 ignored. 282 283======================================== 28412. Windows Support 285======================================== 286 287* The configuration variables PHP_VERSION, PHP_MINOR_VERSION, and 288 PHP_RELEASE_VERSION are now always numbers. Previously, they have been 289 strings for buildconf builds. 290 291* phpize builds now reflect the source tree in the build dir (like that already 292 worked for in-tree builds); some extension builds (especially when using 293 Makefile.frag.w32) may need adjustments. 294 295* --enable-sanitzer is now supported for MSVC builds. This enables ASan and 296 debug assertions, and is supported as of MSVC 16.10 and Windows 10. 297 298* The --with-uncritical-warn-choke configuration option for clang builds is 299 no longer supported. Select warnings to suppress via CFLAGS instead. 300 301* COM: 302 . The extension is now build shared by default; previously it defaulted to a 303 static extension, although the official Windows binaries built a shared 304 extension. 305 306* FFI: 307 . It is no longer necessary to specify the library when using FFI::cdef() 308 and FFI::load(). However, this convenience feature should not be used in 309 production. 310 311* Streams: 312 . If only pipe streams are contained in the $read array, and the $write and 313 $except arrays are empty, stream_select() now behaves similar to POSIX 314 systems, i.e. the function only returns if at least one pipe is ready to be 315 read, or after the timeout expires. Previously, stream_select() returned 316 immediately, reporting all streams as ready to read. 317 318======================================== 31913. Other Changes 320======================================== 321 322- Core: 323 The high resolution timer (`hrtime()`) on macOS now uses the recommended 324 `clock_gettime_nsec_np(CLOCK_UPTIME_RAW)` API instead of 325 `mach_absolute_time()`. 326 327======================================== 32814. Performance Improvements 329======================================== 330 331- XMLReader: 332 . Improved property access performance. 333 334- XMLWriter: 335 . Improved performance and reduce memory consumption. 336