php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42025 strpos(); if $needle = '::', can't find string
Submitted: 2007-07-18 09:01 UTC Modified: 2007-07-26 01:00 UTC
Votes:2
Avg. Score:4.5 ± 0.5
Reproduced:2 of 2 (100.0%)
Same Version:2 (100.0%)
Same OS:2 (100.0%)
From: xatyonline at gmail dot com Assigned:
Status: No Feedback Package: Strings related
PHP Version: 5.2.3 OS: Linux
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: xatyonline at gmail dot com
New email:
PHP Version: OS:

 

 [2007-07-18 09:01 UTC] xatyonline at gmail dot com
Description:
------------
strpos($str, $needles, $offset);

if $str haves ':',
if $needles have ':',
then $offset does not have mean.


Reproduce code:
---------------
$str = "::soon::::soon::::soon::";
for($i=0; $i<3; $i++)
{
	echo(strpos($str, "::soon::", $i).' ');
}

Expected result:
----------------
Normal
--------------------------------------
0 8 16


result
----------------------------------------
0 8 8


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-18 09:10 UTC] jani@php.net
The expected result is 0 8 8 for your code, so what is the problem?
 [2007-07-24 10:23 UTC] jen dot bell at gmail dot com
The offset parameter of strpos is not 'how many matches to skip', it's the character index to start searching from. This should be marked as bogus.
 [2007-07-26 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 17:01:30 2024 UTC