google-code-export / wordpress-custom-content-type-manager

Automatically exported from code.google.com/p/wordpress-custom-content-type-manager
2 stars 1 forks source link

Single quote issue with the text input fields in relation meta #520

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It seems that there is a single quote issue with text fields in relation meta :
1. Create a relation meta content type with 1 text field
2. Add a such a content where you have a single quote in the text field like 
"this won't work"
3. Save
4. The expected output on the admin form should be "this won't work" instead we 
have "this won\'t work"
5. save again without modification
6. the output is now : "this won\\'t work"

A quick and dirty fix for the admin view is to change line 462 from 
custom-content-type-manager/fields/relationmeta.php: 
$out = (array) json_decode($str, true );
with:
$out = (array) json_decode(str_replace("\\\'", "'", $str), true );

thanks for the good job

Original issue reported on code.google.com by morganle...@gmail.com on 3 Sep 2013 at 2:27

GoogleCodeExporter commented 9 years ago
I think your fix might be "correct" -- the problem comes because of how 
WordPress fails to follow conventions when it quotes posted data: for normal 
forms, their solution works, but when you json_encode/json_decode data, you end 
up with double slashes.  Testing...

Original comment by ever...@fireproofsocks.com on 3 Sep 2013 at 4:17

GoogleCodeExporter commented 9 years ago
Committed revision 766365.

Will go out in next version.

Original comment by ever...@fireproofsocks.com on 3 Sep 2013 at 4:26

GoogleCodeExporter commented 9 years ago
Thanks a lot
I will further investigate to see if the bug happens also with double quotes. 
If it's the case I'll let you know
Again you made a terrific job !

Original comment by morganle...@gmail.com on 4 Sep 2013 at 8:29