javascript - json_decode won't work without stripslashes (magic_quotes in Wordpress) -


On the client side I am working with an array of JavaScript objects. I need to send it in PHP with the form on submission and need to manipulate further data on the server side.

So when creating or changing objects toward JavaScript, I am saving it in hidden input. It passes as expected, but the problem is that json_decode returns NULL if I do not do strips-slash before decoding it.

Magic quotes are off because I give PHP> 5.5 and get_magic_quotes_gpc () always FALSE

Can someone explain to me why I need stripsitis in this case, and will it be the case with magic quotes on any production server?

PS Currently, I am still working on the Dev Environment on Windows and EGPP local servers.

Update: Looks like the posted data on the server side ( var_dump ):

UPDATE2: / Strong> I am using Wordpress as the container of my application.

  string (5045) "[[\" address_components \ ": [{\" long_name \ ": \" fluffenstress \ ", \" short_name \ ": \" fluffenstrace \ ". Therefore, I have found a problem after further debugging.  

To answer this, except for the reference of other people here, I took 2 days to find the main reason for this issue.

The one on which I was working was in the form of a WordPress plugin because it was integrated into WordPress. And it has come to know that WordPress (according to current version: 3.8.1) is called slash, load and even with PHP> 5.4 and get_magic_quotes_gpc return 0 Data is still escaped.

The solution is only if you use Wordpress, but who knows that WordPress will disable such behavior and problems in your application will be again :)

For this issue Some links:



Comments

Popular posts from this blog

ios - How do I use CFArrayRef in Swift? -

eclipse plugin - Run java code error: Workspace is closed -

c - Error on building source code in VC 6 -