Bug #74041 [Opn->Csd]: substr_count with length=0 broken

From: Date: Fri, 03 Feb 2017 16:55:30 +0000
Subject: Bug #74041 [Opn->Csd]: substr_count with length=0 broken
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-207154@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74041&edit=1

 ID:                 74041
 Updated by:         nikic@php.net
 Reported by:        nikic@php.net
 Summary:            substr_count with length=0 broken
-Status:             Open
+Status:             Closed
 Type:               Bug
 Package:            *General Issues
 PHP Version:        7.1.1
 Block user comment: N
 Private report:     N

 New Comment:

Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=8660e95b4c7a7a84278104bce4ad8270c1ac3464
Log: Fixed bug #74041


Previous Comments:
------------------------------------------------------------------------
[2017-02-03 16:50:21] nikic@php.net

Description:
------------
substr_count() with length=0 currently is interpreted as using length=strlen(haystack) instead. This
bug has been introduced during the implementation of negative offset support.

https://3v4l.org/fdbpO

Test script:
---------------
<?php
var_dump(substr_count("aaa", "a", 0, 0));

Expected result:
----------------
int(0)

Actual result:
--------------
int(3)


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=74041&edit=1


Thread (2 messages)

« previous php.bugs (#207154) next »