Yii2 escapes all $_POST
variables by adding additional slashes. How to stop that?
(Magic quotes
are disabled in PHP. Additional slashes are added by yii2
, not by PHP
)
Asked
Active
Viewed 293 times
0

Nana Partykar
- 10,556
- 10
- 48
- 77

Dima L.
- 3,443
- 33
- 30
-
1What you are entering and what value you are getting ? – Nana Partykar May 19 '16 at 18:44
2 Answers
2
My bad. Yii doesn't change $_POST. And magic quotes are disabled.
The reason $_POST variables are escaped is because in my yii app I'm loading Wordpress wp-load.php and it is Wordpress who changed $_POST.
It is done in wp-settings.php by calling wp_magic_quotes() function. To avoid this I remember contents of $_GET, $_POST, $_REQUEST, $_COOKIE and $_SERVER, then load wp-load.php, cache all data I need from WP and revert back.
Thanks for your comments!

Dima L.
- 3,443
- 33
- 30
0
Yii2 doesn't change $_POST
in any way because it's considered a bad practice.
The problem is most likely with magic quotes, check it once again more accurately.
Related questions: