Skip to content

PHP 8.4 documentation tracker #3872

Open
@Girgias

Description

@Girgias

Pages which need to be added/modified for complete documentation of PHP 8.4:

Based of the migration guide: https://www.php.net/manual/en/migration84.php (#3822):

Related to php/doc-base#165

Note

This issue is still a Work In Progress
Missing items:

  • PCRE changes

Important

Priority should be given to documenting Core language and ext/standard behavioural changes

Core

New features: ✅

Deprecated: ✅

BC Break:

  • exit() behavioural changes (PHP 8.4: exit() is now a function #4070)
  • Recursion during comparison
  • Indirect Modification of readonly Properties
  • Temporary Filename Length
  • Removal of E_STRICT error level This is an internal engine change

New Functions: ✅

New Classes: ✅

New Constants: ✅

Changed Functions: ✅

Other Changes:

SAPI

apache2handler:

  • Support for EOL Apache 2.0 and 2.2 has been removed. Minimum required Apache version is now 2.4.

FPM:

CLI:

  • The builtin server looks for an index file recursively by traversing parent directories in case the specified file cannot be located.
    This process was previously skipped if the path looked like it was referring to a file,
    i.e. if the last path component contained a period.
    In that case, a 404 error was returned.
    The behavior has been changed to look for an index file in all cases.

Class constants are now typed

New warnings and exceptions

cURL: ✅

GD: ✅

GetText: ✅

Intl: ✅

  • resourcebundle_get(), ResourceBundle::get(), and offset access for ResourceBundle
    • TypeError for invalid offset types
    • ValueError for an empty string
    • ValueError if the integer index does not fit in a signed 32 bit integer
  • IntlDateFormatter::__construct() now throws a ValueError if $locale is invalid
  • NumberFormatter::__construct() now throws a ValueError if $locale is invalid

MBstring: ✅ (#4245)

  • mb_encode_numericentity(), mb_decode_numericentity() now check that $map only has integers
  • mb_http_input() throws ValueError if $type is invalid
  • mb_http_output() throws ValueError if $encoding has null bytes

ODBC: ✅

PCNTL: ✅ (#4208)

  • pcntl_sigprocmask(), pcntl_sigwaitinfo(), and pcntl_sigtimedwait
    • ValueError if $signals array is empty
    • TypeError if $signals array value is not int
    • ValueError if $signals array value is not valid signal
  • pcntl_sigprocmask()
    • ValueError if $mode is not one of SIG_BLOCK, SIG_UNBLOCK or SIG_SETMASK
  • pcntl_sigtimedwait()
    • ValueError if $seconds is less than 0
    • ValueError if $nanoseconds is less than 0
    • ValueError if $seconds and $nanoseconds are both 0

SimpleXML: ✅

Standard: ✅

XMLReader: ✅ (#4123)

  • XMLReader::open() throws ValueError if $encoding is invalid / has nulls
  • XMLReader::XML() throws ValueError if $encoding is invalid / has nulls

XMLWriter: ✅ (#4123)

  • Passing an encoding that contain null bytes now throws a ValueError

XSL: ✅

Resource to Object conversions

DBA: ✅

ODBC:

  • Odbc\Connection
  • Odbc\Result

Soap:

  • Soap\Url
  • Soap\Sdl

Removed extensions ✅ (#4103)

  • ext/imap
  • ext/pspell
  • ext/oci8
  • ext/pdo_oci

Extensions

cURL: ✅

Date: ✅

  • Deprecated:

DBA: ✅

DOM: ✅

GMP:

Hash: ✅ (#4137)

  • Deprecated:
    • Passing invalid options to hash functions is now deprecated.
  • Other changes:
    • hash_update() now has a tentative return type of true instead of bool

Intl:

  • Deprecated: ([PHP 8.4] intl update part 2 #4207)
    • Calling intlcal_set() or IntlCalendar::set() with more than 2 arguments is deprecated, use IntlCalendar::setDate() or IntlCalendar::setDateTime() instead.
    • Calling intlgregcal_create_instance() or IntlGregorianCalendar::__construct() with more than 2 arguments is deprecated, use IntlGregorianCalendar::createFromDate() or IntlGregorianCalendar::createFromDateTime() instead.
  • New Features: ([PHP 8.4] intl update part 2 #4207)
    • Added the NumberFormatter::ROUND_HALFODD to complement the existing NumberFormatter::ROUND_HALFEVEN functionality.
    • Added NumberFormatter::ROUND_TOWARD_ZERO and NumberFormatter::ROUND_AWAY_FROM_ZERO as aliases for NumberFormatter::ROUND_DOWN and NumberFormatter::ROUND_UP to be consistent with the new RoundingMode modes.
  • Other changes:
    • ResourceBundle::get() now has a tentative return type of ResourceBundle|array|string|int|null
    • The idn_to_ascii() and idn_to_utf8() functions now always throw ValueErrors if the domain name is empty or too long.
    • The idn_to_ascii() and idn_to_utf8() functions now always throw ValueErrors if the variant parameter is not INTL_IDNA_VARIANT_UTS46.
    • The behaviour of Intl class has been normalized to always throw Error exceptions when attempting to use a non-initialized object, or when cloning fails.

LDAP:

  • Deprecated: (PHP-8.4: LDAP changes #4066)
    • Calling ldap_connect() with more than 2 arguments is deprecated, use ldap_connect_wallet() instead.
    • Calling ldap_exop() with more than 4 arguments is deprecated, use ldap_exop_sync() instead.

libxml: ✅ (#4051)

  • Other changes:
    • The minimum libxml2 version required is now 2.9.4.
    • libxml_set_streams_context() now immediately throws a TypeError when a non-stream-context resource is passed to the function, instead of throwing later when the stream context is used.

MBString:

  • BC Break:
    • On invalid strings (those with encoding errors), mb_substr() now interprets character indices in the same manner as most other mbstring functions. This means that character indices returned by mb_strpos() can be passed to mb_substr().
    • For SJIS-Mac (MacJapanese) strings, character indices passed to mb_substr() now refer to the indices of the Unicode codepoints which are produced when the string is converted to Unicode. This is significant because around 40 SJIS-Mac characters convert to a sequence of multiple Unicode codepoints.
  • Other changes:
    • The behavior of mb_strcut() is more consistent now on invalid UTF-8 and UTF-16 strings. There is no behavioural change for valid UTF-8 and UTF-16 strings.
    • Unicode data tables have been updated to Unicode 16.0.

MySQLi: ✅

MySQLnd:

  • BC Break:
    • The error code reported for MySQL server wait timeouts has been changed from 2006 to 4031 for MySQL server versions 8.0.24 and above.
  • Other changes:
    • Support for the new VECTOR data type from MySQL 9.

ODBC

  • Other changes:
    • The row of odbc_fetch_object(), odbc_fetch_array(), and odbc_fetch_into() now have a default value of null, consistent with odbc_fetch_row(). Previously, the default values were -1, -1, and 0, respectively.

Opcache:

OpenSSL: ✅

PCNTL:

PCRE:

  • TODO all changes related to lib update
  • BC Break:
    • The bundled pcre2lib has been updated to version 10.44.
  • New Features
    • TODO
    • 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.
      ([PHP 8.4] PCRE - PCRE2-v10.44 updates #4078)

PDO:

  • New Features
    • Subclasses and PDO::connect() (Document new PDO classes and methods #4115)
    • Added a custom parser supporting:
      • single and double-quoted literals, with doubling as escaping mechanism
      • two-dashes and non-nested C-style comments
  • Other changes:
    • It is now possible to fetch the value of the PDO::ATTR_STRINGIFY_FETCHES attribute with PDO::getAttribute().
    • It is now possible to fetch the value of the PDO::PGSQL_ATTR_RESULT_MEMORY_SIZE attribute with PDO::getAttribute().

PDO_DBLIB:

  • BC Break:
    • The DBLIB_ATTR_STRINGIFY_UNIQUEIDENTIFIER and DBLIB_ATTR_DATETIME_CONVERT attributes are now booleans, previously they were int.

PDO_FIREBIRD:

  • BC Break:
    • The ATTR_AUTOCOMMIT attribute is now boolean, previously was int.
    • The extension now requires a C++ compiler and fbclient 3.0 or higher

PDO_MYSQL:

  • BC Break:
    • The ATTR_AUTOCOMMIT, ATTR_EMULATE_PREPARES, and MYSQL_ATTR_DIRECT_QUERY attributes are now booleans, previously they were int.
  • New Features
    • Added a custom parser supporting: (Document new PDO classes and methods #4115)
      • 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:

  • BC Break:
    • The DSN's credentials, when set, are given priority over their PDO constructor counterparts, being closer to the documentation states.
  • Deprecated:
    • Using escaped question marks (??) inside dollar-quoted strings is deprecated.
  • New Features
    • Added a custom parser supporting: (Document new PDO classes and methods #4115)
      • 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
  • Other changes:
    • The minimum libpq version required is now 10.0.

PGSQL:

  • Deprecated:
    • 2 argument signature of pg_fetch_result, pg_field_prtlen, and pg_field_is_null() is now deprecated, use an explicit value of null for $row parameter
  • Other changes:
    • The conditions parameter of pg_select() is now optional and accepts an empty array.
    • The minimum libpq version required is now 10.0.

PDO_SQLITE: ✅

  • New Features
    • Added a custom parser supporting: (Document new PDO classes and methods #4115)
      • 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: ✅ (#4050)

  • New Features
    • Added support for the Unix timestamp extension for Zip archives.
  • Other changes:
    • The Phar::setAlias(), Phar::setDefaultStub() methods now have a tentative return type of true instead of bool.

POSIX: ✅

Random: ✅

Readline: ✅

Reflection: ✅

Session:

SimpleXML:

  • BC Break:
    • SimpleXMLElement now doesn't implicitly rewind itself.

SOAP:

  • BC Break:
    • SoapClient::$typemap is now an array instead of a resource, checks using is_resource() should be converted to check for null
    • Optional dependency on ext/session which has issues with rtld-now
  • Deprecated:
    • Passing an int to SoapServer::addFunction()
    • SOAP_FUNCTIONS_ALL constant
  • New Features
    • Added support for clark notation for namespaces in class map
    • Session persistence now works with a shared session module
    • 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.
  • New Classes
    • Soap\Url
    • Soap\Sdl
  • New Methods

Sockets: ✅

Sodium:

  • Other changes:
    • The sodium_crypto_aead_aes256gcm_*() functions are now available on aarch64 CPUs with the ARM cryptographic extensions.

SPL:

Standard:

Tidy: ✅

XML: ✅ (#4067)

  • BC Break:
    • The xml_set_*() functions now check for proper callables, but see related deprecations
  • Deprecated:
    • xml_set_object()
    • Passing non-callable strings to xml_set_*() functions

XSL: ✅

ZIP: ✅

Zlib: ✅

New Functions

BCMath ✅

Date

  • DateTime::createFromTimestamp
  • DateTime::getMicrosecond
  • DateTime::setMicrosecond
  • DateTimeImmutable::createFromTimestamp
  • DateTimeImmutable::getMicrosecond
  • DateTimeImmutable::setMicrosecond

Hash

  • HashContext::__debugInfo

Intl

MBString ✅

Opcache

  • opcache_jit_blacklist

PDO_PGSQL ✅

PGSQL

XMLReader ✅ (#4138)

  • XMLReader::fromStream
  • XMLReader::fromUri
  • XMLReader::fromString

XMLWriter ✅ (#4138)

  • XMLWriter::toStream
  • XMLWriter::toUri
  • XMLWriter::toMemory

New Classes

BCMath

  • BcMath\Number

DOM (#4212, #4306)

  • Dom\HTMLDocument
  • Dom\XMLDocument
  • New Dom\Node classes?

ODBC

  • Odbc\Connection
  • Odbc\Result

PDO_DBLIB ✅

PDO_FIREBIRD ✅

PDO_MYSQL ✅

PDO_ODBC ✅

PDO_PGSQL ✅

PDO_SQLITE ✅

New Constants

cURL ✅

Intl

  • PATTERN
  • PROPERTY_IDS_UNARY_OPERATOR
  • PROPERTY_ID_COMPAT_MATH_START
  • PROPERTY_ID_COMPAT_MATH_CONTINUE

LDAP

  • LDAP_OPT_X_TLS_PROTOCOL_MAX
  • LDAP_OPT_X_TLS_PROTOCOL_TLS1_3

libxml ✅

MySQLi ✅

OpenSSL

  • X509_PURPOSE_OCSP_HELPER
  • X509_PURPOSE_TIMESTAMP_SIGN

PCNTL ✅

  • SIGCKPT (DragonFlyBSD only) (Pcntl php84 #4073)
  • SIGCKPTEXIT (DragonFlyBSD only) (Pcntl php84 #4073)
  • WEXITED
  • WSTOPPED
  • WNOWAIT
  • P_ALL
  • P_PID
  • P_PGID
  • P_PIDFD (Linux only)
  • P_UID (NetBSD/FreeBSD only)
  • P_GID (NetBSD/FreeBSD only)
  • P_SID (NetBSD/FreeBSD only)
  • P_JAILID (FreeBSD only)

PGSQL ✅

POSIX ✅

Sockets ✅

Sodium ✅

XML ✅

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions