rfc:counting_non_countables

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revisionBoth sides next revision
rfc:counting_non_countables [2016/10/17 20:47] – Remove the outstanding question about count(null) duncan3dcrfc:counting_non_countables [2016/10/19 14:14] – Don't deprecate without a clear plan, just add a warning duncan3dc
Line 1: Line 1:
 ====== PHP RFC: Counting of non-countable objects ====== ====== PHP RFC: Counting of non-countable objects ======
-  * Version: 0.3+  * Version: 0.4
   * Date: 2016-10-04   * Date: 2016-10-04
   * Author: Craig Duncan <git@duncanc.co.uk>   * Author: Craig Duncan <git@duncanc.co.uk>
Line 27: Line 27:
 ===== Proposal ===== ===== Proposal =====
  
-This RFC proposes deprecating count with a parameter that is a scalar, null, or an object that doesn't implement Countable.+This RFC proposes adding a warning when calling ''count()'' with a parameter that is a scalar, null, or an object that doesn't implement Countable.
  
 //Note that the sizeof alias is also affected.// http://php.net/manual/en/function.sizeof.php //Note that the sizeof alias is also affected.// http://php.net/manual/en/function.sizeof.php
Line 33: Line 33:
 ===== Backward Incompatible Changes ===== ===== Backward Incompatible Changes =====
  
-Nonedeprecating features does not break BC.+The call to ''count()'' will still return 1 (or 0 for null) so backwards compatibility is maintained. 
 + 
 +Environments that display warnings or convert them to more severe errors/exceptions would be affectedbut this should just bring attention to a bug in the code.
  
 ===== Proposed PHP Version(s) ===== ===== Proposed PHP Version(s) =====
Line 46: Line 48:
  
 Patch to handle the change: Patch to handle the change:
-https://github.com/duncan3dc/php-src/commit/d253a1680361e63d070b324cf5a33493120f8050+https://github.com/duncan3dc/php-src/commit/ea03689a800dfeb0b94b0b7a2a0ed837c280f27f
  
 Example tests: Example tests:
-https://github.com/duncan3dc/php-src/commit/46a4f0061956f27ec195e3d497005a0a8c00ceb6+https://github.com/duncan3dc/php-src/commit/3e4fa60b63c94a7015d09f7310e6653ece86db05
  
 =====References ===== =====References =====
rfc/counting_non_countables.txt · Last modified: 2018/03/01 23:26 by carusogabriel