Both sides previous revisionPrevious revisionNext revision | Previous revision |
rfc:invalid_strings_in_arithmetic [2016/03/30 15:41] – Link to UPGRADING ajf | rfc:invalid_strings_in_arithmetic [2017/09/22 13:28] (current) – external edit 127.0.0.1 |
---|
This inconsistency is unintuitive, and becomes a greater problem if we add warnings and notices for non-numeric strings, as some operators would tell you strings like ''"1.2345e9"'' and ''"-123.45"'' are non-well-formed, whereas other operators would happily accept such strings. | This inconsistency is unintuitive, and becomes a greater problem if we add warnings and notices for non-numeric strings, as some operators would tell you strings like ''"1.2345e9"'' and ''"-123.45"'' are non-well-formed, whereas other operators would happily accept such strings. |
| |
To avoid this problem, this RFC proposes use ''is_numeric_string_ex'' instead of ''strtol'' for the integer operators and integer casts (<php>intval()</php> with <php>$base</php> = 10, <php>(int)</php>, <php>settype()</php>, etc.), resolving the inconsistency. This also affects the Zend Engine C functions ''zval_get_long'' and ''convert_to_long'', and so PHP functions which uses these internal functions are also affected, including <php>decbin()</php>, <php>decoct()</php> and <php>dechex()</php>. | To avoid this problem, this RFC proposes to use ''is_numeric_string_ex'' instead of ''strtol'' for the integer operators and integer casts (<php>intval()</php> with <php>$base</php> = 10, <php>(int)</php>, <php>settype()</php>, etc.), resolving the inconsistency. This also affects the Zend Engine C functions ''zval_get_long'' and ''convert_to_long'', and so PHP functions which uses these internal functions are also affected, including <php>decbin()</php>, <php>decoct()</php> and <php>dechex()</php>. |
| |
===== Backward Incompatible Changes ===== | ===== Backward Incompatible Changes ===== |
The interpreter patch was merged into 7.1 here: https://github.com/php/php-src/commit/1e82ad8038d3100b7e27be870652c1f639a7200a | The interpreter patch was merged into 7.1 here: https://github.com/php/php-src/commit/1e82ad8038d3100b7e27be870652c1f639a7200a |
| |
The UPGRADING file notes can be found here (more extensive than in the previously-linked patch), see sections 1 and 2: https://github.com/php/php-src/blob/5be140004d8079dca6e91801c1857d1119bf4408/UPGRADING | The UPGRADING file notes can be found here (more extensive than in the previously-linked patch), see sections 1 and 2: https://github.com/php/php-src/blob/0105bd20b706c8ab5b0a71f59f11a9dabe735f6b/UPGRADING |
| |
The language specification patch was merged into 7.1 here: https://github.com/php/php-langspec/commit | The corresponding mention in the manual can be found here: http://php.net/manual/en/migration71.other-changes.php |
/a3ea4e992f43ea9083c3fe3738a5ded03412f6e1 | |
| |
After the project is implemented, this section should contain | The language specification patch was merged into 7.1 here: https://github.com/php/php-langspec/commit/a3ea4e992f43ea9083c3fe3738a5ded03412f6e1 |
- a link to the PHP manual entry for the feature | |
| |
===== References ===== | ===== References ===== |