rfc:stricter_implicit_boolean_coercions

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
rfc:stricter_implicit_boolean_coercions [2022/05/31 19:40] iquitorfc:stricter_implicit_boolean_coercions [2022/06/20 16:00] (current) – Change status to declined and close voting iquito
Line 3: Line 3:
   * Date: 2022-05-16   * Date: 2022-05-16
   * Author: Andreas Leathley, <a.leathley@gmx.net>   * Author: Andreas Leathley, <a.leathley@gmx.net>
-  * Status: Under Discussion+  * Status: Declined
   * First Published at: http://wiki.php.net/rfc/stricter_implicit_boolean_coercions   * First Published at: http://wiki.php.net/rfc/stricter_implicit_boolean_coercions
  
Line 160: Line 160:
 ^ From bool    | always possible (coerced to "" or "1") | always possible (coerced to 0 or 1)                      | always possible (coerced to 0 or 1)                                          | ^ From bool    | always possible (coerced to "" or "1") | always possible (coerced to 0 or 1)                      | always possible (coerced to 0 or 1)                                          |
  
-This RFC would further reduce the gap between strict mode and coercive mode, as even in coercive mode no information would be lost when coercing a scalar value and only values that are reasonable are accepted (otherwise a deprecation notice is emitted). All allowed coercions can be reversed to end up with the original value or almost the same ("0" can become "" and vice versa) - that is something this RFC makes possible, as without this RFC reversing a coercion to boolean will often not lead back to the original value. These examples illustrate reversibility and the loss of information:+This RFC would further reduce the gap between strict mode and coercive mode, as even in coercive mode no information would be lost when coercing a scalar value and only values that are reasonable are accepted (otherwise a deprecation notice is emitted). All allowed coercions can be reversed to end up with the original value or almost the same ("0" can become "") - that is something this RFC makes possible, as without this RFC reversing a coercion to boolean will often not lead back to the original value. These examples illustrate reversibility and the loss of information:
  
 <PHP> <PHP>
Line 248: Line 248:
   * Implicit boolean expressions (as used in if, ternary, logic operators) are not affected.   * Implicit boolean expressions (as used in if, ternary, logic operators) are not affected.
   * FILTER_VALIDATE_BOOLEAN in the filter extension is not affected.   * FILTER_VALIDATE_BOOLEAN in the filter extension is not affected.
 +  
 +===== Vote =====
 +
 +Voting started on 2022-06-06 and will end on 2022-06-20.
 +
 +<doodle title="Accept Stricter implicit boolean coercions RFC as proposed?" auth="iquito" voteType="single" closed="true">
 +   * Yes
 +   * No
 +</doodle>
  
 ===== Patches and Tests ===== ===== Patches and Tests =====
rfc/stricter_implicit_boolean_coercions.1654026001.txt.gz · Last modified: 2022/05/31 19:40 by iquito