rfc:invalid_strings_in_arithmetic

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
rfc:invalid_strings_in_arithmetic [2016/03/30 00:49] – Implemented ajfrfc:invalid_strings_in_arithmetic [2016/12/10 19:23] – to ajf
Line 68: Line 68:
 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 =====
Line 148: Line 148:
 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 language specification patch was merged into 7.1 here: https://github.com/php/php-langspec/commit +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 
-/a3ea4e992f43ea9083c3fe3738a5ded03412f6e1+ 
 +The language specification patch was merged into 7.1 here: https://github.com/php/php-langspec/commit/a3ea4e992f43ea9083c3fe3738a5ded03412f6e1
  
 After the project is implemented, this section should contain  After the project is implemented, this section should contain 
rfc/invalid_strings_in_arithmetic.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1