top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Apache: Single quotes in ajax POST data getting prefixed with backslash

+1 vote
640 views

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.

posted Dec 9, 2013 by Bob Wise

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

+1 vote

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.

answer Dec 9, 2013 by Seema Siddique
Similar Questions
+2 votes

Is it possible to use PHP 5.2.5 with Apache/2.4.6?

I have an application that was written in WAMP5 using PHP 5.2.5, and I am trying to get the application onto a CentOS server and I can't get it to work with 5.4.16.

Are there any good tutorials on using an older version of PHP with Apache?

+1 vote

I want to be able to run a specific php version with apache. So uninstalled apache and php then installed apache, and then built php from source to have the right version.

Now In the browser when i put an html file it works but php files do not. Can someone tell me how to link my php with apache without upgrading my php?

+4 votes

We want to set up SSL client authentication and we will only have a single client that we want to allow through to the website.

Is it possible to allow just a single certificate to authenticate by just specifying that one cert in SSLCACertificateFile? i.e. without specifying the CA cert instead?

If so, would my SSLVerifyDepth then be zero?

Are there any reasons I might not have thought about why this isn't a good idea or any other considerations?

...