Home  >  Article  >  Backend Development  >  Regarding the automatic escaping problem of PHP, the historical issues of magic_quotes_gpc in the configuration

Regarding the automatic escaping problem of PHP, the historical issues of magic_quotes_gpc in the configuration

WBOY
WBOYOriginal
2016-08-08 09:25:121750browse

Today, my friend’s website had another problem (due to various problems that had just been moved to a new space), so I checked the problem and found that php decoded the data

and changed it to NULL. This is very strange, so I tested it locally and there was no problem. Then I checked online and found that the format required for decoding is very strict

Even if it is slightly inaccurate, it will not work, so I typed the data with var_dump. , it was found that it was escaped, but there was no problem.

1. Then I did the first test

I decoded the data (data printed by var_dump, copied out) directly, and the result was OK. (It can be local or external)

2. Get the data decode directly

The result is displayed as NULL

I wonder why this is. . . . .

Every time the php version is upgraded, I rarely care about what content has changed. At most, I will download the latest version. This is indeed a bad habit,

Haha, I don’t do it anymore , my win php is 5.3, my mac is 5.6, and the external server is 5.2, a total of 3 versions

So I thought for a while whether it might be a php version problem (because it can be used locally)

I checked online and sure enough, it is true. There is a magic_quotes_gpc option in php.ini. Open phpinfo () and find that it is ON

This option will escape the user input content. After php5.4 The version has been removed, the modification steps are as follows

1. Open php.ini

2. Find the location of magic_quotes_gpc

3. Change NO to Off

4. Restart the server

everything is ok.

The above has introduced the issue of automatic escaping in PHP and the historical issues left over by magic_quotes_gpc in the configuration, including the content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn