Re: substr with null length
| From: | Christoph M. Becker | Date: | Mon, 21 Oct 2019 15:39:16 +0000 |
| Subject: | Re: substr with null length | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-107605@lists.php.net to get a copy of this message | ||
On 20.10.2019 at 17:00, Colin O'Dell wrote:
> Is there any particular reason why the substr() function doesn't accept a
> null $length like mb_substr() does? It seems the behavior to read through
> the end of the string can only be controlled by the presence or absence of
> the $length parameter: https://3v4l.org/YpuO1
The reason for this behavioral inconsistency is that when mb_substr()'s
behavior has been changed[1], substr()'s has not. Due to the subtle BC
break, in my opinion, this shouldn't have been changed in a revision
(happened for 5.4.8); a major version is *more* suitable for such changes.
> I'd be happy to write the RFC […]
It seems to me that an RFC would be overkill for this change, but it has
to be discussed.
Tentatively, I'm +0.5 on this change.
[1]
<https://github.com/php/php-src/commit/352a1956b60059f9792cac840d57b184c7305667>
--
Christoph M. Becker