PHP 8.4.2 Released!

Changelog

The following changes have been made to classes/functions/methods of this extension.

VersionFunctionDescription
8.4.0str_getcsvRelying on the default value of escape is now deprecated.
 str_getcsvNow throws a ValueError if separator, enclosure, or escape is invalid. This mimics the behavior of fgetcsv and fputcsv.
 strcspnPrior to PHP 8.4.0, when characters was the empty string, the search would incorrectly stop at the first null byte in string.
8.3.0number_formatAdded handling of negative values for decimals.
 str_getcsvAn empty string is returned instead of a string with a single null byte for the last field if it contains only an unterminated enclosure.
 strrchrThe before_needle parameter was added.
 strtokNow emits E_WARNING when token is not provided.
8.2.0lcfirstCase conversion no longer depends on the locale set with setlocale. Only ASCII characters will be converted.
 str_ireplaceCase folding no longer depends on the locale set with setlocale. Only ASCII case folding will be done. Non-ASCII bytes will be compared by their byte value.
 str_splitIf string is empty an empty array is now returned. Previously an array containing a single empty string was returned.
 strcasecmpThis function is no longer guaranteed to return strlen($string1) - strlen($string2) when string lengths are not equal, but may now return -1 or 1 instead.
 strcmpThis function is no longer guaranteed to return strlen($string1) - strlen($string2) when string lengths are not equal, but may now return -1 or 1 instead.
 striposCase folding no longer depends on the locale set with setlocale. Only ASCII case folding will be done. Non-ASCII bytes will be compared by their byte value.
 stristrCase folding no longer depends on the locale set with setlocale. Only ASCII case folding will be done. Non-ASCII bytes will be compared by their byte value.
 strnatcasecmpThis function is no longer guaranteed to return strlen($string1) - strlen($string2) when string lengths are not equal, but may now return -1 or 1 instead.
 strnatcmpThis function is no longer guaranteed to return strlen($string1) - strlen($string2) when string lengths are not equal, but may now return -1 or 1 instead.
 strncasecmpThis function is no longer guaranteed to return strlen($string1) - strlen($string2) when string lengths are not equal, but may now return -1 or 1 instead.
 strncmpThis function is no longer guaranteed to return strlen($string1) - strlen($string2) when string lengths are not equal, but may now return -1 or 1 instead.
 strriposCase folding no longer depends on the locale set with setlocale. Only ASCII case folding will be done. Non-ASCII bytes will be compared by their byte value.
 strtolowerCase conversion no longer depends on the locale set with setlocale. Only ASCII characters will be converted.
 strtoupperCase conversion no longer depends on the locale set with setlocale. Only ASCII characters will be converted.
 substr_compareThis function is no longer guaranteed to return strlen($string1) - strlen($string2) when string lengths are not equal, but may now return -1 or 1 instead.
 ucfirstCase conversion no longer depends on the locale set with setlocale. Only ASCII characters will be converted.
 ucwordsCase conversion no longer depends on the locale set with setlocale. Only ASCII characters will be converted.
 utf8_decodeThis function has been deprecated.
 utf8_encodeThis function has been deprecated.
8.1.0get_html_translation_tableflags changed from ENT_COMPAT to ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401.
 html_entity_decodeflags changed from ENT_COMPAT to ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401.
 htmlentitiesflags changed from ENT_COMPAT to ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401.
 htmlspecialcharsflags changed from ENT_COMPAT to ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401.
 htmlspecialchars_decodeflags changed from ENT_COMPAT to ENT_QUOTES | ENT_SUBSTITUTE | ENT_HTML401.
8.0.0convert_uuencodePrior to this version, trying to convert an empty string returned false for no particular reason.
 count_charsPrior to this version, the function returned false on failure.
 cryptThe salt is no longer optional.
 explodeexplode will now throw ValueError when separator parameter is given an empty string (""). Previously, explode returned false instead.
 fprintfThis function no longer returns false on failure.
 fprintfThrow a ValueError if the number of arguments is zero; previously this function emitted a E_WARNING instead.
 fprintfThrow a ValueError if [width] is less than zero or bigger than PHP_INT_MAX; previously this function emitted a E_WARNING instead.
 fprintfThrow a ValueError if [precision] is less than zero or bigger than PHP_INT_MAX; previously this function emitted a E_WARNING instead.
 fprintfThrow a ArgumentCountError when less arguments are given than required; previously this function emitted a E_WARNING instead.
 html_entity_decodeencoding is nullable now.
 htmlentitiesencoding is nullable now.
 implodePassing the separator after the array is no longer supported.
 levenshteinPrior to this version, levenshtein had to be called with either two or five arguments.
 levenshteinPrior to this version, levenshtein would return -1 if one of the argument strings is longer than 255 characters.
 metaphoneThe function returned false on failure.
 number_formatPrior to this version, number_format accepted one, two, or four parameters (but not three).
 parse_strresult is no longer optional.
 printfThis function no longer returns false on failure.
 printfThrow a ValueError if the number of arguments is zero; previously this function emitted a E_WARNING instead.
 printfThrow a ValueError if [width] is less than zero or bigger than PHP_INT_MAX; previously this function emitted a E_WARNING instead.
 printfThrow a ValueError if [precision] is less than zero or bigger than PHP_INT_MAX; previously this function emitted a E_WARNING instead.
 printfThrow a ArgumentCountError when less arguments are given than required; previously this function emitted a E_WARNING instead.
 soundexPrior to this version, calling the function with an empty string returned false for no particular reason.
 sprintfThis function no longer returns false on failure.
 sprintfThrow a ValueError if the number of arguments is zero; previously this function emitted a E_WARNING instead.
 sprintfThrow a ValueError if [width] is less than zero or bigger than PHP_INT_MAX; previously this function emitted a E_WARNING instead.
 sprintfThrow a ValueError if [precision] is less than zero or bigger than PHP_INT_MAX; previously this function emitted a E_WARNING instead.
 sprintfThrow a ArgumentCountError when less arguments are given than required; previously this function emitted a E_WARNING instead.
 str_splitIf length is less than 1, a ValueError will be thrown now; previously, an error of level E_WARNING has been raised instead, and the function returned false.
 str_word_countcharacters is nullable now.
 strcspnlength is nullable now.
 strip_tagsallowed_tags is nullable now.
 striposneedle now accepts an empty string.
 striposPassing an int as needle is no longer supported.
 stristrneedle now accepts an empty string.
 stristrPassing an int as needle is no longer supported.
 strposneedle now accepts an empty string.
 strposPassing an int as needle is no longer supported.
 strrchrneedle now accepts an empty string.
 strrchrPassing an int as needle is no longer supported.
 strriposneedle now accepts an empty string.
 strriposPassing an int as needle is no longer supported.
 strrposneedle now accepts an empty string.
 strrposPassing an int as needle is no longer supported.
 strspnlength is nullable now.
 strstrneedle now accepts an empty string.
 strstrPassing an int as needle is no longer supported.
 substrlength is nullable now. When length is explicitly set to null, the function returns a substring finishing at the end of the string, when it previously returned an empty string.
 substrThe function returns an empty string where it previously returned false.
 substr_comparelength is nullable now.
 substr_countlength is nullable now.
 substr_replacelength is nullable now.
 vfprintfThis function no longer returns false on failure.
 vfprintfThrow a ValueError if the number of arguments is zero; previously this function emitted a E_WARNING instead.
 vfprintfThrow a ValueError if [width] is less than zero or bigger than PHP_INT_MAX; previously this function emitted a E_WARNING instead.
 vfprintfThrow a ValueError if [precision] is less than zero or bigger than PHP_INT_MAX; previously this function emitted a E_WARNING instead.
 vfprintfThrow a ValueError when less arguments are given than required; previously this function emitted a E_WARNING instead.
 vprintfThis function no longer returns false on failure.
 vprintfThrow a ValueError if the number of arguments is zero; previously this function emitted a E_WARNING instead.
 vprintfThrow a ValueError if [width] is less than zero or bigger than PHP_INT_MAX; previously this function emitted a E_WARNING instead.
 vprintfThrow a ValueError if [precision] is less than zero or bigger than PHP_INT_MAX; previously this function emitted a E_WARNING instead.
 vprintfThrow a ValueError when less arguments are given than required; previously this function emitted a E_WARNING instead.
 vsprintfThis function no longer returns false on failure.
 vsprintfThrow a ValueError if the number of arguments is zero; previously this function emitted a E_WARNING instead.
 vsprintfThrow a ValueError if [width] is less than zero or bigger than PHP_INT_MAX; previously this function emitted a E_WARNING instead.
 vsprintfThrow a ValueError if [precision] is less than zero or bigger than PHP_INT_MAX; previously this function emitted a E_WARNING instead.
 vsprintfThrow a ValueError when less arguments are given than required; previously this function emitted a E_WARNING instead.
 wordwrapIf break is empty string, a ValueError is thrown; previously in this case it emitted an E_WARNING and returned false.
7.4.0chrThe function no longer silently accepts unsupported codepoints, and casts these to 0.
 implodePassing the separator after the array (i.e. using the legacy signature) has been deprecated.
 money_formatThis function has been deprecated. Instead, use NumberFormatter::formatCurrency.
 str_getcsvThe escape parameter now interprets an empty string as signal to disable the proprietary escape mechanism. Formerly, an empty string was treated like the default parameter value.
 strip_tagsThe allowed_tags now alternatively accepts an array.
7.3.5substr_compareoffset may now be equal to the length of haystack.
7.3.0striposPassing an int as needle has been deprecated.
 stristrPassing an int as needle has been deprecated.
 strposPassing an int as needle has been deprecated.
 strrchrPassing an int as needle has been deprecated.
 strriposPassing an int as needle has been deprecated.
 strrposPassing an int as needle has been deprecated.
 strstrPassing an int as needle has been deprecated.
7.2.18substr_compareoffset may now be equal to the length of haystack.
7.2.0number_formatnumber_format was changed to not being able to return -0, previously -0 could be returned for cases like where num would be -0.01.
 parse_strUsage of parse_str without a second parameter now emits an E_DEPRECATED notice.
 utf8_decodeThis function has been moved from the XML extension to the core of PHP. In previous versions, it was only available if the XML extension was installed.
 utf8_encodeThis function has been moved from the XML extension to the core of PHP. In previous versions, it was only available if the XML extension was installed.
7.1.0str_shuffleThe internal randomization algorithm has been changed to use the Mersenne Twister Random Number Generator instead of the libc rand function.
 striposSupport for negative offsets has been added.
 strposSupport for negative offsets has been added.
 substr_countSupport for negative offsets and lengths has been added. length may also be 0 now.
add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top