acf-city-selector icon indicating copy to clipboard operation
acf-city-selector copied to clipboard

City won't selected if its string contain apex

Open hardweb-it opened this issue 3 years ago • 3 comments

@Beee4life I found an issue on your lastest 1.3.1 version of plugin.

If the City name contain apex (or apostrophe), it won't "saved" properly. For example:

"City name" is saved properly. "City's name" won't saved. Debugging a bit: in database the value of City appear stored as serialized array without any escape char before the apex.

I opened the "acfcs-functions.php" and edit the lines 536, 543 and 550 with:

$selected_value = esc_attr($stored_value);

Now the City with apex will appear properly as selected on the dropdown.

That's strange, before appling the above code, by echoing $key and $selected_value, they appears as equal strings, but at line 572 the ternary condition doesn't work as expected.

I'm no pretty sure about this method could be the best, maybe you need to check or escape the chars before store values. I have not much time to investigate better, but take a look and check yourself.

hardweb-it avatar Apr 23 '21 11:04 hardweb-it

Ok, thanks, will try to look into it this weekend...

Beee4life avatar Apr 23 '21 11:04 Beee4life

Fixed in this commit.

Beee4life avatar Apr 27 '21 18:04 Beee4life

I see you hearted the previous reply but did it all work for you ?

Beee4life avatar Sep 10 '21 19:09 Beee4life