PHP 8.5 Codex Changelog

Newly added Improvements Changed Deprecations Removals
INI Directives 6 39 2 1
Constants 38 15 40
Classes 11 8 2
Extensions 2 2
Functions 16 67 7 16
Attributes 2
Enums 2

Changed

INI Directives

Global

Constants

curl

filter

gd

pcre

standard

Classes

ext-dom

ext-Reflection

Core

  • Directory
    • Cloning class objects is no longer allowed
    • Class is marked final

Newly added

INI Directives

Global

Extensions

Global

Constants

Core

curl

filter

openssl

pgsql

posix

sockets

standard

tokenizer

Functions

Core

ext-curl

ext-enchant

ext-intl

ext-pgsql

Core

ext-Zend OPcache

Attributes

Core

Classes

ext-curl

ext-filter

ext-intl

ext-uri

Enums

ext-uri

Deprecations

INI Directives

Global

  • intl.error_level

    INI directive deprecated: Using a value different than 0 for intl.error_level is deprecated, as the intl.error_level INI setting is deprecated. Instead the intl.use_exceptions INI setting should be enabled to throw exceptions on errors or intl_get_error_code()/intl_get_error_message() should be used to manually deal with errors

  • report_memleaks

    INI directive deprecated: Directive 'report_memleaks' is deprecated

Constants

date

  • DATE_RFC7231

    Constant deprecated

    var_dump(DATE_RFC7231);
    // D, d M Y H:i:s \G\M\T
    Constant DATE_RFC7231 is deprecated since 8.5, as this format ignores the associated timezone and always uses GMT

hash

Functions

ext-curl

ext-fileinfo

ext-gd

ext-mysqli

Core

ext-xml

Removals

Extensions

Global

INI Directives

Global

Functions

ext-pcntl

Core

ext-xmlrpc

Classes

ext-PDO_Firebird

ext-xmlrpc

Improvements

Functions

ext-date

  • timezone_transitions_get

    Parameter default value changed for position #3 ($timestampEnd): PHP_INT_MAX to 2147483647

      timezone_transitions_get(
          DateTimeZone $object,
          int $timestampBegin = PHP_INT_MIN,
    -     int $timestampEnd = PHP_INT_MAX
    +     int $timestampEnd = 2147483647
        ): array|false

ext-ftp

  • ftp_set_option

    Return type changed: bool to true

      ftp_set_option(
          FTP\Connection $ftp,
          int $option,
          $value
    -   ): bool
    +   ): true

ext-gd

  • imagelayereffect

    Return type changed: bool to true

    - imagelayereffect(GdImage $image, int $effect): bool
    + imagelayereffect(GdImage $image, int $effect): true
  • imageline

    Return type changed: bool to true

      imageline(
          GdImage $image,
          int $x1,
          int $y1,
          int $x2,
          int $y2,
          int $color
    -   ): bool
    +   ): true
  • imagerectangle

    Return type changed: bool to true

      imagerectangle(
          GdImage $image,
          int $x1,
          int $y1,
          int $x2,
          int $y2,
          int $color
    -   ): bool
    +   ): true
  • imageresolution

    Return type changed: array|bool to array|true

      imageresolution(
          GdImage $image,
          ?int $resolution_x = null,
          ?int $resolution_y = null
    -   ): array|bool
    +   ): array|true
  • imagesavealpha

    Return type changed: bool to true

    - imagesavealpha(GdImage $image, bool $enable): bool
    + imagesavealpha(GdImage $image, bool $enable): true
  • imagesetbrush

    Return type changed: bool to true

    - imagesetbrush(GdImage $image, GdImage $brush): bool
    + imagesetbrush(GdImage $image, GdImage $brush): true
  • imagesetclip

    Return type changed: bool to true

      imagesetclip(
          GdImage $image,
          int $x1,
          int $y1,
          int $x2,
          int $y2
    -   ): bool
    +   ): true
  • imagesetpixel

    Return type changed: bool to true

      imagesetpixel(
          GdImage $image,
          int $x,
          int $y,
          int $color
    -   ): bool
    +   ): true
  • imagesetthickness

    Return type changed: bool to true

    - imagesetthickness(GdImage $image, int $thickness): bool
    + imagesetthickness(GdImage $image, int $thickness): true
  • imagesettile

    Return type changed: bool to true

    - imagesettile(GdImage $image, GdImage $tile): bool
    + imagesettile(GdImage $image, GdImage $tile): true
  • imagestring

    Return type changed: bool to true

      imagestring(
          GdImage $image,
          GdFont|int $font,
          int $x,
          int $y,
          string $string,
          int $color
    -   ): bool
    +   ): true
  • imagestringup

    Return type changed: bool to true

      imagestringup(
          GdImage $image,
          GdFont|int $font,
          int $x,
          int $y,
          string $string,
          int $color
    -   ): bool
    +   ): true
  • imagecolordeallocate

    Return type changed: bool to true

    - imagecolordeallocate(GdImage $image, int $color): bool
    + imagecolordeallocate(GdImage $image, int $color): true
  • imageflip

    Return type changed: bool to true

    - imageflip(GdImage $image, int $mode): bool
    + imageflip(GdImage $image, int $mode): true
  • imagealphablending

    Return type changed: bool to true

    - imagealphablending(GdImage $image, bool $enable): bool
    + imagealphablending(GdImage $image, bool $enable): true
  • imageantialias

    Return type changed: bool to true

    - imageantialias(GdImage $image, bool $enable): bool
    + imageantialias(GdImage $image, bool $enable): true
  • imagearc

    Return type changed: bool to true

      imagearc(
          GdImage $image,
          int $center_x,
          int $center_y,
          int $width,
          int $height,
          int $start_angle,
          int $end_angle,
          int $color
    -   ): bool
    +   ): true
  • imagechar

    Return type changed: bool to true

      imagechar(
          GdImage $image,
          GdFont|int $font,
          int $x,
          int $y,
          string $char,
          int $color
    -   ): bool
    +   ): true
  • imagecharup

    Return type changed: bool to true

      imagecharup(
          GdImage $image,
          GdFont|int $font,
          int $x,
          int $y,
          string $char,
          int $color
    -   ): bool
    +   ): true
  • imagecolormatch

    Return type changed: bool to true

    - imagecolormatch(GdImage $image1, GdImage $image2): bool
    + imagecolormatch(GdImage $image1, GdImage $image2): true
  • imagecopy

    Return type changed: bool to true

      imagecopy(
          GdImage $dst_image,
          GdImage $src_image,
          int $dst_x,
          int $dst_y,
          int $src_x,
          int $src_y,
          int $src_width,
          int $src_height
    -   ): bool
    +   ): true
  • imagecopymerge

    Return type changed: bool to true

      imagecopymerge(
          GdImage $dst_image,
          GdImage $src_image,
          int $dst_x,
          int $dst_y,
          int $src_x,
          int $src_y,
          int $src_width,
          int $src_height,
          int $pct
    -   ): bool
    +   ): true
  • imagecopymergegray

    Return type changed: bool to true

      imagecopymergegray(
          GdImage $dst_image,
          GdImage $src_image,
          int $dst_x,
          int $dst_y,
          int $src_x,
          int $src_y,
          int $src_width,
          int $src_height,
          int $pct
    -   ): bool
    +   ): true
  • imagecopyresampled

    Return type changed: bool to true

      imagecopyresampled(
          GdImage $dst_image,
          GdImage $src_image,
          int $dst_x,
          int $dst_y,
          int $src_x,
          int $src_y,
          int $dst_width,
          int $dst_height,
          int $src_width,
          int $src_height
    -   ): bool
    +   ): true
  • imagecopyresized

    Return type changed: bool to true

      imagecopyresized(
          GdImage $dst_image,
          GdImage $src_image,
          int $dst_x,
          int $dst_y,
          int $src_x,
          int $src_y,
          int $dst_width,
          int $dst_height,
          int $src_width,
          int $src_height
    -   ): bool
    +   ): true
  • imagedashedline

    Return type changed: bool to true

      imagedashedline(
          GdImage $image,
          int $x1,
          int $y1,
          int $x2,
          int $y2,
          int $color
    -   ): bool
    +   ): true
  • imageellipse

    Return type changed: bool to true

      imageellipse(
          GdImage $image,
          int $center_x,
          int $center_y,
          int $width,
          int $height,
          int $color
    -   ): bool
    +   ): true
  • imagefill

    Return type changed: bool to true

      imagefill(
          GdImage $image,
          int $x,
          int $y,
          int $color
    -   ): bool
    +   ): true
  • imagefilledarc

    Return type changed: bool to true

      imagefilledarc(
          GdImage $image,
          int $center_x,
          int $center_y,
          int $width,
          int $height,
          int $start_angle,
          int $end_angle,
          int $color,
          int $style
    -   ): bool
    +   ): true
  • imagefilledellipse

    Return type changed: bool to true

      imagefilledellipse(
          GdImage $image,
          int $center_x,
          int $center_y,
          int $width,
          int $height,
          int $color
    -   ): bool
    +   ): true
  • imagefilledrectangle

    Return type changed: bool to true

      imagefilledrectangle(
          GdImage $image,
          int $x1,
          int $y1,
          int $x2,
          int $y2,
          int $color
    -   ): bool
    +   ): true
  • imagefilltoborder

    Return type changed: bool to true

      imagefilltoborder(
          GdImage $image,
          int $x,
          int $y,
          int $border_color,
          int $color
    -   ): bool
    +   ): true
  • imagegammacorrect

    Return type changed: bool to true

      imagegammacorrect(
          GdImage $image,
          float $input_gamma,
          float $output_gamma
    -   ): bool
    +   ): true

ext-intl

  • intltz_create_enumeration

    Parameter type added for parameter #1 ($countryOrRawOffset): string|int|null

    - intltz_create_enumeration($countryOrRawOffset = null): IntlIterator|false
    + intltz_create_enumeration(string|int|null $countryOrRawOffset = null): IntlIterator|false
  • transliterator_get_error_code

    Return type changed: int|false to int

    - transliterator_get_error_code(Transliterator $transliterator): int|false
    + transliterator_get_error_code(Transliterator $transliterator): int
  • transliterator_get_error_message

    Return type changed: string|false to string

    - transliterator_get_error_message(Transliterator $transliterator): string|false
    + transliterator_get_error_message(Transliterator $transliterator): string
  • datefmt_set_timezone

    Parameter type added for parameter #2 ($timezone): IntlTimeZone|DateTimeZone|string|null

    - datefmt_set_timezone(IntlDateFormatter $formatter, $timezone): bool
    + datefmt_set_timezone(IntlDateFormatter $formatter, IntlTimeZone|DateTimeZone|string|null $timezone): bool
  • datefmt_create

    Parameter type added for parameter #4 ($timezone): IntlTimeZone|DateTimeZone|string|null

      datefmt_create(
          ?string $locale,
          int $dateType = IntlDateFormatter::FULL,
          int $timeType = IntlDateFormatter::FULL,
    -     $timezone = null,
    +     IntlTimeZone|DateTimeZone|string|null $timezone = null,
          IntlCalendar|int|null $calendar = null,
          ?string $pattern = null
        ): ?IntlDateFormatter
  • grapheme_stripos
    • Optional parameter added - #4: string $locale = ""
     grapheme_stripos(
         string $haystack,
         string $needle,
    -    int $offset = 0
    +    int $offset = 0,
    +    string $locale = ""
       ): int|false
  • grapheme_stristr
    • Optional parameter added - #4: string $locale = ""
     grapheme_stristr(
         string $haystack,
         string $needle,
    -    bool $beforeNeedle = false
    +    bool $beforeNeedle = false,
    +    string $locale = ""
       ): string|false
  • grapheme_strpos
    • Optional parameter added - #4: string $locale = ""
     grapheme_strpos(
         string $haystack,
         string $needle,
    -    int $offset = 0
    +    int $offset = 0,
    +    string $locale = ""
       ): int|false
  • grapheme_strripos
    • Optional parameter added - #4: string $locale = ""
     grapheme_strripos(
         string $haystack,
         string $needle,
    -    int $offset = 0
    +    int $offset = 0,
    +    string $locale = ""
       ): int|false
  • grapheme_strrpos
    • Optional parameter added - #4: string $locale = ""
     grapheme_strrpos(
         string $haystack,
         string $needle,
    -    int $offset = 0
    +    int $offset = 0,
    +    string $locale = ""
       ): int|false
  • grapheme_strstr
    • Optional parameter added - #4: string $locale = ""
     grapheme_strstr(
         string $haystack,
         string $needle,
    -    bool $beforeNeedle = false
    +    bool $beforeNeedle = false,
    +    string $locale = ""
       ): string|false
  • grapheme_substr
    • Optional parameter added - #4: string $locale = ""
     grapheme_substr(
         string $string,
         int $offset,
    -    ?int $length = null
    +    ?int $length = null,
    +    string $locale = ""
       ): string|false
  • intlcal_create_instance

    Parameter type added for parameter #1 ($timezone): IntlTimeZone|DateTimeZone|string|null

    - intlcal_create_instance($timezone = null, ?string $locale = null): ?IntlCalendar
    + intlcal_create_instance(IntlTimeZone|DateTimeZone|string|null $timezone = null, ?string $locale = null): ?IntlCalendar
  • intlcal_set_time_zone

    Parameter type added for parameter #2 ($timezone): IntlTimeZone|DateTimeZone|string|null

    - intlcal_set_time_zone(IntlCalendar $calendar, $timezone): bool
    + intlcal_set_time_zone(IntlCalendar $calendar, IntlTimeZone|DateTimeZone|string|null $timezone): bool

ext-ldap

  • ldap_get_option

    Parameter type changed for parameter #1 ($ldap): LDAP\Connection to ?LDAP\Connection

      ldap_get_option(
    -     LDAP\Connection $ldap,
    +     ?LDAP\Connection $ldap,
          int $option,
          &$value = null
        ): bool

ext-libxml

  • libxml_set_external_entity_loader

    Return type changed: bool to true

    - libxml_set_external_entity_loader(?callable $resolver_function): bool
    + libxml_set_external_entity_loader(?callable $resolver_function): true

ext-openssl

  • openssl_public_encrypt
    • Optional parameter added - #5: ?string $digest_algo = null
     openssl_public_encrypt(
         string $data,
         &$encrypted_data,
         $public_key,
    -    int $padding = OPENSSL_PKCS1_PADDING
    +    int $padding = OPENSSL_PKCS1_PADDING,
    +    ?string $digest_algo = null
       ): bool
  • openssl_cms_encrypt

    Parameter type changed for parameter #7 ($cipher_algo): int to string|int

      openssl_cms_encrypt(
          string $input_filename,
          string $output_filename,
          $certificate,
          ?array $headers,
          int $flags = 0,
          int $encoding = OPENSSL_ENCODING_SMIME,
    -     int $cipher_algo = OPENSSL_CIPHER_AES_128_CBC
    +     string|int $cipher_algo = OPENSSL_CIPHER_AES_128_CBC
        ): bool
  • openssl_private_decrypt
    • Optional parameter added - #5: ?string $digest_algo = null
     openssl_private_decrypt(
         string $data,
         &$decrypted_data,
         $private_key,
    -    int $padding = OPENSSL_PKCS1_PADDING
    +    int $padding = OPENSSL_PKCS1_PADDING,
    +    ?string $digest_algo = null
       ): bool
  • openssl_sign
    • Optional parameter added - #5: int $padding = 0
     openssl_sign(
         string $data,
         &$signature,
         $private_key,
    -    string|int $algorithm = OPENSSL_ALGO_SHA1
    +    string|int $algorithm = OPENSSL_ALGO_SHA1,
    +    int $padding = 0
       ): bool
  • openssl_verify
    • Optional parameter added - #5: int $padding = 0
     openssl_verify(
         string $data,
         string $signature,
         $public_key,
    -    string|int $algorithm = OPENSSL_ALGO_SHA1
    +    string|int $algorithm = OPENSSL_ALGO_SHA1,
    +    int $padding = 0
       ): int|false

ext-pcntl

  • pcntl_exec

    Return type changed: bool to false

      pcntl_exec(
          string $path,
          array $args = [],
          array $env_vars = []
    -   ): bool
    +   ): false
  • pcntl_waitid
    • Optional parameter added - #5: &$resource_usage = []
     pcntl_waitid(
         int $idtype = P_ALL,
         ?int $id = null,
         &$info = [],
    -    int $flags = WEXITED
    +    int $flags = WEXITED,
    +    &$resource_usage = []
       ): bool

ext-pgsql

  • pg_copy_from

    Parameter type changed for parameter #3 ($rows): array to Traversable|array

      pg_copy_from(
          PgSql\Connection $connection,
          string $table_name,
    -     array $rows,
    +     Traversable|array $rows,
          string $separator = "\t",
          string $null_as = "\\\\N"
        ): bool

ext-readline

  • readline_add_history

    Return type changed: bool to true

    - readline_add_history(string $prompt): bool
    + readline_add_history(string $prompt): true
  • readline_callback_handler_install

    Return type changed: bool to true

    - readline_callback_handler_install(string $prompt, callable $callback): bool
    + readline_callback_handler_install(string $prompt, callable $callback): true
  • readline_clear_history

    Return type changed: bool to true

    - readline_clear_history(): bool
    + readline_clear_history(): true

Core

  • array_multisort

    Return type changed: bool to true

    - array_multisort(&$array, ...&$rest): bool
    + array_multisort(&$array, ...&$rest): true

ext-sysvshm

  • shm_detach

    Return type changed: bool to true

    - shm_detach(SysvSharedMemory $shm): bool
    + shm_detach(SysvSharedMemory $shm): true

ext-zlib

  • gzopen
    • Parameter type changed for parameter #3 ($use_include_path): int to bool
    • Parameter default value changed for position #3 ($use_include_path): 0 to false
      gzopen(
          string $filename,
          string $mode,
    -     int $use_include_path = 0
    +     bool $use_include_path = false
        )
  • readgzfile
    • Parameter type changed for parameter #2 ($use_include_path): int to bool
    • Parameter default value changed for position #2 ($use_include_path): 0 to false
    - readgzfile(string $filename, int $use_include_path = 0): int|false
    + readgzfile(string $filename, bool $use_include_path = false): int|false
  • gzfile
    • Parameter type changed for parameter #2 ($use_include_path): int to bool
    • Parameter default value changed for position #2 ($use_include_path): 0 to false
    - gzfile(string $filename, int $use_include_path = 0): array|false
    + gzfile(string $filename, bool $use_include_path = false): array|false
Subscribe to PHP.Watch newsletter for monthly updates

You will receive an email on last Wednesday of every month and on major PHP releases with new articles related to PHP, upcoming changes, new features and what's changing in the language. No marketing emails, no selling of your contacts, no click-tracking, and one-click instant unsubscribe from any email you receive.