rfc:zpp_fail_on_overflow

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
Last revisionBoth sides next revision
rfc:zpp_fail_on_overflow [2014/12/02 12:25] – Some cleanup and clarity ajfrfc:zpp_fail_on_overflow [2015/01/01 02:53] – Added version next to "Implemented" ajf
Line 1: Line 1:
 ====== PHP RFC: ZPP Failure on Overflow ====== ====== PHP RFC: ZPP Failure on Overflow ======
   * Version: 0.1.1   * Version: 0.1.1
-  * Date: 2014-09-22, Last Updated 2014-11-29+  * Date: 2014-09-22, Last Updated 2014-12-02
   * Author: Andrea Faulds, ajf@ajf.me   * Author: Andrea Faulds, ajf@ajf.me
-  * Status: Under Discussion+  * Status: Implemented (PHP 7.0)
   * First Published at: http://wiki.php.net/rfc/zpp_fail_on_overflow   * First Published at: http://wiki.php.net/rfc/zpp_fail_on_overflow
  
 ===== Introduction ===== ===== Introduction =====
  
-PHP is a weakly-typed language, and so implicitly converts between integers and floats when passed to internal functions. Currently, when a float that is beyond the range of an integer (outside [PHP_INT_MIN, PHP_INT_MAX]) is passed to an internal function expecting an integer argument, it will silently truncate (e.g. ''3221225470.5'' becomes ''-1073741826'' on 32-bit platforms), causing a loss of magnitude and sign information, though technically preserving the "lower bits". This mangling of input happens without warning, is unintuitive, and can lead to subtle bugs.+PHP is a weakly-typed language, and so implicitly converts between integers and floats when such values are passed to internal functions. Currently, when a float that is beyond the range of an integer (outside [PHP_INT_MIN, PHP_INT_MAX]) is passed to an internal function expecting an integer argument, it will silently truncate (e.g. ''3221225470.5'' becomes ''-1073741826'' on 32-bit platforms), causing a loss of magnitude and sign information, though technically preserving the "lower bits". This mangling of input happens without warning, is unintuitive, and can lead to subtle bugs.
  
 ===== Proposal ===== ===== Proposal =====
Line 20: Line 20:
 ===== Backward Incompatible Changes ===== ===== Backward Incompatible Changes =====
  
-This is an inherently backwards-incompatible change. However, it is behaviour that is dangerous, and this will only affect uncommon edge cases. In the unusual even that the truncation/NaN-tolerant behaviour is desired by the programmer, an explicit ''(int)'' cast can be used.+This is an inherently backwards-incompatible change. However, the previous behaviour was dangerous, and this will only affect uncommon edge cases. In the unusual event that the truncation/NaN-tolerant behaviour is desired by the programmer, an explicit ''(int)'' cast can be used.
  
 ===== Proposed PHP Version(s) ===== ===== Proposed PHP Version(s) =====
Line 30: Line 30:
 This does not affect other implicit integer casts, such as those done with array keys or by the bitwise operators. This does not affect other implicit integer casts, such as those done with array keys or by the bitwise operators.
    
-===== Proposed Voting Choices =====+===== Vote =====
  
-This is arguably not a language change. However, as it breaks backwards-compatibility, and because some may argue it //is// a language change, a 2/3 majority will be required. The vote will be a straight Yes/No vote.+This is arguably not a language change. However, as it breaks backwards-compatibility, and because some may argue it //is// a language change, a 2/3 majority will be required. The vote is a straight Yes/No vote. 
 + 
 +Voting opened on 2014-12-02 and ended on 2014-12-12. 
 + 
 +<doodle title="Accept the ZPP Failure on Overflow RFC and merge into master?" auth="ajf" voteType="single" closed="true"> 
 +   * Yes 
 +   * No 
 +</doodle>
  
 ===== Patches and Tests ===== ===== Patches and Tests =====
Line 39: Line 46:
  
 ===== Implementation ===== ===== Implementation =====
-After the project is implemented, this section should contain  + 
-  - the version(s) it was merged to +This was merged into master here: https://github.com/php/php-src/commit/0ea0b591d79ae0ee18d33533a5c701330836ff6b 
-  a link to the git commit(s) + 
-  - a link to the PHP manual entry for the feature+It will form part of PHP 7.
  
 ===== References ===== ===== References =====
rfc/zpp_fail_on_overflow.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1