Mantis Bugtracker

Viewing Issue Advanced Details Jump to Notes ] View Simple ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0004494 [Quercus] major always 04-11-11 23:31 07-27-18 04:09
Reporter lionel_hutz12 View Status public  
Assigned To
Priority normal Resolution open Platform Apache Tomcat 6.0.29 Server
Status new   OS Windows
Projection none   OS Version 7
ETA none Fixed in Version Product Version 3.2.1
  Product Build
Summary 0004494: substr_count does not provide an accurate count when the search string is repeated in succession
Description substr_count skips the second instance of the search character(s) when they appear in succession in the searched string. For example, if you are searching for the number of times the character 'a' is present in the searched string and the search string contains "aa" it will only report 1 instance, instead of 2 times.
Steps To Reproduce $diff_string = "aaaaa";
echo "Should produce 5, but only shows (3): " . substr_count($diff_string, "a");
Additional Information Work around for this issue, may be to use:
preg_match_all('/a/', "aaaaa", $chunks);

which accurately prints out 5
Attached Files

- Relationships

- Notes
04-12-11 02:55

Issue fixed on CC branch.
Patch proposal: [^]
07-27-18 04:09

Thanks for posting a work around, this is still a bug in Resin Pro 4.0.55, was driving me insane.

- Issue History
Date Modified Username Field Change
04-11-11 23:31 lionel_hutz12 New Issue
04-12-11 02:55 kdecherf Note Added: 0005189
07-27-18 04:09 Glynn Note Added: 0006844

Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
32 total queries executed.
28 unique queries executed.
Powered by Mantis Bugtracker