|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #75781 substr_count incorrect result
Submitted: 2018-01-08 22:52 UTC Modified: -
From: gajowy at agzeta dot pl Assigned:
Status: Closed Package: Strings related
PHP Version: 7.1.13 OS: Windows 10 64bit
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: gajowy at agzeta dot pl
New email:
PHP Version: OS:


 [2018-01-08 22:52 UTC] gajowy at agzeta dot pl
For "big" string the substr_count function returns incorrect result.
Memory limit in PHP set to 30GB.
Seems it works incorrect for strings>4GB.

Test script:
$size=9*1024*1024*1024;		// 9GB
for( $i=0; $i<$size; $i++ )
	if( $i%3==0 )

Expected result:

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-01-09 08:23 UTC]
Automatic comment on behalf of
Log: Fixed bug #75781 (substr_count incorrect result)
 [2018-01-09 08:23 UTC]
-Status: Open +Status: Closed
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 25 10:01:31 2024 UTC