From b2248789ed21300aaf356336bf43b6b065183fcb Mon Sep 17 00:00:00 2001 From: George Peter Banyard Date: Wed, 29 Jul 2020 02:51:09 +0100 Subject: Implement 'Saner Numeric Strings' RFC: RFC: https://wiki.php.net/rfc/saner-numeric-strings This removes the -1 allow_error mode from is_numeric_string functions and replaces it by a trailing boolean out argument to preserve BC in a couple of places. Most of the changes can be resumed to "numeric" strings which emitted a E_NOTICE now emit a E_WARNING and "numeric" strings which emitted a E_WARNING now throw a TypeError. This mostly affects: - String offsets - Arithmetic operations - Bitwise operations Closes GH-5762 --- UPGRADING | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'UPGRADING') diff --git a/UPGRADING b/UPGRADING index 6eca850664..28aa584862 100644 --- a/UPGRADING +++ b/UPGRADING @@ -217,6 +217,27 @@ PHP 8.0 UPGRADE NOTES . debug_backtrace() and Exception::getTrace() will no longer provide references to arguments. It will not be possible to change function arguments through the backtrace. + . The concept of numeric-string has been altered to be less error prone. + Trailing whitespaces are now allowed in numeric strings making it symmetric + with how leading whitespaces were treated. + This mostly affects: + - The is_numeric() function + - String-to-string comparisons + - Type declarations + - Increment and Decrement operations + The concept of "leading-numeric string" has been mostly dropped, the cases + where this concept remains is in order to ease migration. + String which emitted an E_NOTICE "A non well formed numeric value encountered" + will now emit an E_WARNING "A non-numeric value encountered" + and all strings which emitted an E_WARNING "A non-numeric value encountered" + will now throw a TypeError. + This mostly affects: + - Arithmetic operations + - Bitwise operations + This E_WARNING to TypeError change also affects the E_WARNING + "Illegal string offset 'string'" for illegal string offsets. + This does not change the behaviour of explicit casts to int/float from strings. + RFC: https://wiki.php.net/rfc/saner-numeric-strings - COM: . Removed the ability to import case-insensitive constants from type -- cgit v1.2.1