You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Tim Streater <ti...@clothears.org.uk> on 2013/12/09 22:56:00 UTC
[users@httpd] Single quotes in ajax POST data getting prefixed with backslash
I run an instance of apache under OS X which I use to pass data to PHP scripts using ajax. If I have a string such as "O'Toole" (without the double-quotes), then when the string (which I pass through encodeURIComponent in the browser) arrives in the PHP script, the single-quote is prefixed with a backslash. That is, the string above becomes "O\'Toole".
I want my app to run under Win7, and I observe that there, the backslash is *not* inserted. This difference is a bit irritating, especially as I am having trouble discovering which component (browser, apache, PHP) is adding the backslash. On the whole, I'd rather not have it, but I'd settle for both platforms adding it. Then at least code common to both platforms can remove it.
Any guidance as to where to look would be appreciated.
--
Cheers -- Tim
Re: [users@httpd] Single quotes in ajax POST data getting prefixed
with backslash
Posted by Yehuda Katz <ye...@ymkatz.net>.
That is a PHP configuration option called Magic Quotes (
http://www.php.net/manual/en/info.configuration.php#ini.magic-quotes-gpc)
that used to be on by default and is now off by default in recent PHP
releases.
- Y
Sent from a gizmo with a very small keyboard and hyperactive autocorrect.
On Dec 9, 2013 4:57 PM, "Tim Streater" <ti...@clothears.org.uk> wrote:
> I run an instance of apache under OS X which I use to pass data to PHP
> scripts using ajax. If I have a string such as "O'Toole" (without the
> double-quotes), then when the string (which I pass through
> encodeURIComponent in the browser) arrives in the PHP script, the
> single-quote is prefixed with a backslash. That is, the string above
> becomes "O\'Toole".
>
> I want my app to run under Win7, and I observe that there, the backslash
> is *not* inserted. This difference is a bit irritating, especially as I am
> having trouble discovering which component (browser, apache, PHP) is adding
> the backslash. On the whole, I'd rather not have it, but I'd settle for
> both platforms adding it. Then at least code common to both platforms can
> remove it.
>
> Any guidance as to where to look would be appreciated.
>
> --
> Cheers -- Tim
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>