Single and Double quotes are escaped with a backslash
Single and Double quotes are escaped with a backslash
broder22
Posts: 5Questions: 2Answers: 1
Fields with single or double quotes have a backslash appended before the quote, the number of backslashes seem to double each time the field is saved.
I have tried disabling xss on the field, which hasnt helped.
Field::inst( 'orders.taxnotes' )->xss( false ),
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi @broder22 ,
I just tried this - I'm assuming you're using Editor - and it behaved as expected.
We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.
Cheers,
Colin
Thanks for the response! Sorry I didn't include one right away. I stripped it down to the most basic html/php/js and it still seems to behave this way. If I had to guess I'd say its related to the JSON responses, as this is how it escapes quotes.
https://fitzpatrickselect.com/beta/test.html
Hi @broder22 ,
It might also be a PHP issue - these two SO threads here and here may help, they show how to prevent it on that end. Could you give that a try too please, just to confirm either way,
Cheers,
Colin
Seems like that was the problem, thanks for your help! I guess it was just an odd default setting by the web host.
It sounds like "magic quotes" was enabled on the server, or something like that. It was a hacky way to try and prevent SQL injection in old PHP scripts. Thankfully, that option is gone in modern PHP, but I guess it lives on in legacy!
Allan