CodeIgniter Forums
PHP stripping souble quotes on POST - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: PHP stripping souble quotes on POST (/showthread.php?tid=12551)



PHP stripping souble quotes on POST - El Forum - 10-23-2008

[eluser]Nathan Pitman (Nine Four)[/eluser]
Has anyone ever experienced a situation where PHP strips double quotes on a POST to a web service? We're running a web service on our server and after a PHP upgrade double quotes in serialized arrays that we are passing in the POST are being stripped... we're using NuSOAP.


PHP stripping souble quotes on POST - El Forum - 10-23-2008

[eluser]manilodisan[/eluser]
This forum strips double quotes as well. Are you using CI on your website?


PHP stripping souble quotes on POST - El Forum - 10-23-2008

[eluser]Nathan Pitman (Nine Four)[/eluser]
Not in this part of the app, we ended up using an abstracted version of the Active Record Library from CI along with NuSOAP for the web services.

POST from a web page is fine but POST from Flash (in our case) ends up with the double quotes stripped. I think this is somehow related to 'HTTP_RAW_POST_DATA' since we managed a temporary fix by adding:

Code:
$HTTP_RAW_POST_DATA = ereg_replace(""",'"',$HTTP_RAW_POST_DATA);
$HTTP_RAW_POST_DATA = ereg_replace("'","'",$HTTP_RAW_POST_DATA);

...before we pass the POST data to NuSOAP. :/


PHP stripping souble quotes on POST - El Forum - 10-23-2008

[eluser]manilodisan[/eluser]
Why not base64_encode it before being sent and decode on the PHP end..?


PHP stripping souble quotes on POST - El Forum - 10-23-2008

[eluser]Nathan Pitman (Nine Four)[/eluser]
unfortunately not an option as the software is out there and in circulation so I can't amend how the data is passed from Flash. So far as I'm aware though Flash always url encodes before it posts, the script I have added is forcing PHP to urldecode just the double and single quotes (in theory) before passing to NuSOAP... even though it was working without prior to the upgrade. My hosts seem to have no idea so I might have to chalk this up as an unknown and just be wary of running future PHP upgrades... :/

In the future though I think I will certainly take a more bullet proof approach in how I pass the data!