Page 1 of 1

Problem Replacing or checking for Double Quotes in a string

Posted: Mon Mar 23, 2009 8:36 am
by AGISB
At this point I am pulling my hair and I am bouncing my head against the monitor. Here is what I do:

I am getting a search term via Form post. Now I simply what to check if the user used " " to mark a search term. In that case I would need to add 'IN BOOLEAN MODE' to the mysql query otherwise I don't need that.

No the crazyness begins.

I used str_pos to check for " in the string but whatever I do it does not work. I tried string replace and again I can replace anything but the "

I used
str_replace('"',"@", $stringname);
str_replace("\"","@", $stringname);

Then I thought use htmlentities and I actually got &quote; instead of the " but
str_replace('"',"@", $stringname);
str_replace(""","@", $stringname);

Still does not work.

Well I thought of mafic_quotes finally but the string has no \" in it anyhow.

Is it possible that there is some kind of bug in php 5.2.8 or am I a total idiot that is pulling his hair for hours over a normally really simple thing?

Re: Problem Replacing or checking for Double Quotes in a string

Posted: Mon Mar 23, 2009 8:51 am
by AGISB
Ok I am completely blind today ......


Just in case someone ever has this problem


I used the vbulletin sanitizer that filters html out. Instead of cutting it off it runs htmlentities on it.


Now my string comes and I check it like always echoing it on the screen. I see the " but I didn't check the source code. When checking I of course saw that I got " in my string instead of " :banghead: