rfc:string_to_number_comparison

Differences

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

Link to this comparison view

Next revision
Previous revision
Next revisionBoth sides next revision
rfc:string_to_number_comparison [2019/02/26 09:03] – created nikicrfc:string_to_number_comparison [2019/02/26 12:46] – typo nikic
Line 2: Line 2:
   * Date: 2019-02-26   * Date: 2019-02-26
   * Author: Nikita Popov <nikic@php.net>   * Author: Nikita Popov <nikic@php.net>
-  * Status: Draft+  * Status: Under Discussion
   * Target Version: PHP 8.0   * Target Version: PHP 8.0
 +  * Implementation: https://github.com/php/php-src/pull/3886
  
 ===== Introduction ===== ===== Introduction =====
Line 164: Line 165:
 It should be mentioned that the setlocale() dependence [[https://externals.io/message/103638|may go away]] in PHP 8, but this hasn't been formally proposed yet. It should be mentioned that the setlocale() dependence [[https://externals.io/message/103638|may go away]] in PHP 8, but this hasn't been formally proposed yet.
  
-An alternative approach to this issue would be to define that the float to string conversion used for comparisons does not respective the locale and always uses automatically determined precision (''precision=-1'').+An alternative approach to this issue would be to define that the float to string conversion used for comparisons does not respect the locale and always uses automatically determined precision (''precision=-1'').
  
 ==== Special values ==== ==== Special values ====
Line 187: Line 188:
 ===== Backward Incompatible Changes ===== ===== Backward Incompatible Changes =====
  
-This change to the semantics of non-strict comparisons is backwards incompatible. Worse, it constitutes a silent change in core language semantics. Code that worked one way in PHP 7.4 will work differently in PHP 8.0. Use of static analysis to detect cases that may be affect is likely to yield many false positives.+This change to the semantics of non-strict comparisons is backwards incompatible. Worse, it constitutes a silent change in core language semantics. Code that worked one way in PHP 7.4 will work differently in PHP 8.0. Use of static analysis to detect cases that may be affected is likely to yield many false positives.
  
 One possible way to mitigate the impact is to introduce an ini setting in PHP 7.4, which will perform the comparison using both the old and the new method and emit a deprecation warning if the results differ. This would allow identifying affected code based on production logs. One possible way to mitigate the impact is to introduce an ini setting in PHP 7.4, which will perform the comparison using both the old and the new method and emit a deprecation warning if the results differ. This would allow identifying affected code based on production logs.
rfc/string_to_number_comparison.txt · Last modified: 2020/07/31 12:55 by nikic