On the client side, I'm working with array of JavaScript objects. On submit I need to send it to PHP with form and manipulate the data further on the server-side.
So when building or changing an array of objects on the JavaScript side, I'm saving it to hidden input. It is passes with the form as expected, but the problem is that json_decode
returns NULL
if I don't stripslashes
before decoding it.
Magic Quotes are off as I use PHP > 5.5, and get_magic_quotes_gpc()
always returns FALSE
.
Why do I need stripslashes in this case, and will this be the case on any production server with magic quotes off?
P.S.: Currently I'm still working on a development environment on Windows and an EasyPHP local server.
Posted data on server side looks like (var_dump
):
I'm using WordPress as a container of my application.
string(5045) "[{\"address_components\":[{\"long_name\":\"Flughafenstrasse\",\"short_name\":\"Flughafenstrasse\"...