serialized-editor icon indicating copy to clipboard operation
serialized-editor copied to clipboard

Strings with backslashes (\) cause errors

Open rosswintle opened this issue 2 years ago • 0 comments

I can't see this logged anywhere, but strings with \ raise errors.

I'm seeing this in the data saved by wp_queue

A minimal case would be:

O:14:"Simpsons\Homer":1:{s:14:"favouriteDrink";s:9:"Duff Beer";}

This outputs:

CleanShot 2022-03-18 at 17 02 22

And the console shows:

SyntaxError: JSON.parse: bad escaped character at line 1 column 33 of the JSON data

CleanShot 2022-03-18 at 17 03 45

Changing the \ to - fixes the issue.

rosswintle avatar Mar 18 '22 17:03 rosswintle