rfc:proper-range-semantics

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:proper-range-semantics [2023/03/30 13:30] – Version 0.2 girgiasrfc:proper-range-semantics [2023/05/08 09:24] – Clarification nits girgias
Line 348: Line 348:
 The changes are as follows: The changes are as follows:
  
-  * If <php>$step</php> is a float but is compatible with ''int'' interpret it as an integer.+  * If <php>$step</php> is a float but is compatible with ''int'' (i.e. <php>(float)(int)$step === $step</php>interpret it as an integer.
   * Introduce and use a proper ZPP check for ''int|float|string'' <php>$start</php> and <php>$end</php> parameters, this will cause <php>TypeError</php>s to be thrown when passing objects, resources, and arrays to <php>range()</php>. It will also cause a deprecation warning to be emitted when passing ''null''.   * Introduce and use a proper ZPP check for ''int|float|string'' <php>$start</php> and <php>$end</php> parameters, this will cause <php>TypeError</php>s to be thrown when passing objects, resources, and arrays to <php>range()</php>. It will also cause a deprecation warning to be emitted when passing ''null''.
   * Throw value errors if <php>$start</php>, <php>$end</php>, or <php>$step</php> is a non-finite float (-INF, INF, NAN).   * Throw value errors if <php>$start</php>, <php>$end</php>, or <php>$step</php> is a non-finite float (-INF, INF, NAN).
Line 354: Line 354:
   * Throw a <php>ValueError</php> when passing a negative <php>$step</php> for increasing ranges.   * Throw a <php>ValueError</php> when passing a negative <php>$step</php> for increasing ranges.
   * Emit an <php>E_WARNING</php> when <php>$start</php> or <php>$end</php> is the empty string, and cast the value to ''0''   * Emit an <php>E_WARNING</php> when <php>$start</php> or <php>$end</php> is the empty string, and cast the value to ''0''
-  * Emit an <php>E_WARNING</php> when <php>$start</php> or <php>$end</php> has more than one byte.+  * Emit an <php>E_WARNING</php> when <php>$start</php> or <php>$end</php> has more than one byte if it is a non-numeric string.
   * Emit an <php>E_WARNING</php> when <php>$start</php> or <php>$end</php> is cast to an integer because the other boundary input is a number or numeric string. (e.g. <php>range('5', 'z');</php> or <php>range(5, 'z');</php>)   * Emit an <php>E_WARNING</php> when <php>$start</php> or <php>$end</php> is cast to an integer because the other boundary input is a number or numeric string. (e.g. <php>range('5', 'z');</php> or <php>range(5, 'z');</php>)
   * Emit an <php>E_WARNING</php> when <php>$step</php> is a float when trying to generate a range of characters.   * Emit an <php>E_WARNING</php> when <php>$step</php> is a float when trying to generate a range of characters.
rfc/proper-range-semantics.txt · Last modified: 2023/06/19 13:41 by girgias