Edit report at http://bugs.php.net/bug.php?id=52198&edit=1

 ID:               52198
 Updated by:       ras...@php.net
 Reported by:      christian dot gnoth at arcor dot de
 Summary:          strpos not working correctly
 Status:           Bogus
 Type:             Bug
 Package:          Strings related
 Operating System: Linux
 PHP Version:      5.2.13

 New Comment:

The test script I showed you used variables, not static strings.



My guess (since I can't decipher your messy code) is that your POST data
is 

probably getting parsed or filtered and the contents isn't what you
think it is.  

Your & might actually be & so the strpos isn't going to match.  Look
for 

issues along those lines.  strpos works fine, so the longer you keep
blaming 

strpos the longer it will take you to find your bug.


Previous Comments:
------------------------------------------------------------------------
[2010-06-28 18:26:24] paj...@php.net

If you are experiencing a problem with strpos and variables, then please
provide a script similar to:



$haystack = "some content";

$needle = "content";



if (strpos($haystack, $needle) === false)) {

  echo "not found\n";

} else {

  echo "found\n";

}



Everything else is irrelevant.



However, as Rasmus said, there is no difference in strpos if you pass a
static variable or a string.

------------------------------------------------------------------------
[2010-06-28 18:20:08] christian dot gnoth at arcor dot de

Hello,

that 5 lines are working - I do not doubt. That is not the problem here.
Again, strpos is working with static strings passed, but with
variables.



That is a fact as you can see it. The output is generated at the only
position in the else tree!!!! So with strpos working correctly it should
never go there for that string!!!



If you like, I can send you the MySQL dump file and the php script.

------------------------------------------------------------------------
[2010-06-28 17:15:54] ras...@php.net

Your bug is elsewhere.  There is no difference between passing a static
string and 

passing a variable.  The only difference happens if the contents of the
variable 

is different.  Write a 5-line script that reproduces the problem and you
will see.

------------------------------------------------------------------------
[2010-06-28 17:08:11] christian dot gnoth at arcor dot de

as you can see the strpos function works also in my script it returns
the position 40, but only in the static passing of the strings. In the
work process - the function is called for each url - somehow the
variables are not processed correctly (maybe some problem in the memory
areas???). The content of the variables is shwon correctly through the
echo construct, but the content is not processed correctly by the strpos
function.

------------------------------------------------------------------------
[2010-06-28 16:08:43] ras...@php.net

The test script I provided doesn't work?

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


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

    http://bugs.php.net/bug.php?id=52198


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

Reply via email to