Doc #73613 [Ver->Csd]: Not warning if length == 0

From: Date: Mon, 03 Sep 2018 21:28:33 +0000
Subject: Doc #73613 [Ver->Csd]: Not warning if length == 0
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-15975@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=73613&edit=1 ID: 73613 Updated by: cmb@php.net Reported by: ua dot san dot alex at gmail dot com Summary: Not warning if length == 0 -Status: Verified +Status: Closed Type: Documentation Problem Package: Strings related PHP Version: 7.1.0RC6 Assigned To: cmb Block user comment: N Private report: N New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. Previous Comments: ------------------------------------------------------------------------ [2018-09-03 21:28:09] cmb@php.net Automatic comment from SVN on behalf of cmb Revision: http://svn.php.net/viewvc/?view=revision&amp;revision=345591 Log: Fix #73613: Not warning if length == 0 ------------------------------------------------------------------------ [2018-09-03 21:02:53] cmb@php.net For the record: the actual bug has been fixed in the meantime (see bug #74041). ------------------------------------------------------------------------ [2016-11-28 10:27:46] cmb@php.net <https://3v4l.org/bAu27> looks like a bug in substr_count() to me. Shouldn't the respective if condition[1] actually be length < 0? [1] <https://github.com/php/php-src/blob/php-7.1.0RC6/ext/standard/string.c#L5220> ------------------------------------------------------------------------ [2016-11-27 11:35:20] ua dot san dot alex at gmail dot com Do you think this is normal behavior, 0 function takes long and looking over the entire length? Here is an example: https://3v4l.org/3B2Ct In PHP 5.6 this behavior in the case of other ------------------------------------------------------------------------ [2016-11-27 09:25:04] nikic@php.net To add to this, the reason is that substr_count() now also accepts a negative length parameter with the usual meaning. We could still explicitly exclude the case length=0, but, as @requinix mentions, it doesn't really make sense. We allow length=0 elsewhere and it is useful if $length is not a hardcoded value. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=73613 -- Edit this bug report at https://bugs.php.net/bug.php?id=73613&edit=1

« previous php.doc.bugs (#15975) next »