the-events-calendar / the-events-calendar-category-colors

Plugin add-on for The Events Calendar to colorize categories
https://wordpress.org/plugins/the-events-calendar-category-colors
45 stars 19 forks source link

Japanese event category slugs cause log warning #139

Closed kadamwhite closed 1 year ago

kadamwhite commented 1 year ago

I noticed today some new log warnings,

[09-Nov-2022 15:56:58 UTC] PHP Warning:  Undefined array key "%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88-text" in /plugins/the-events-calendar-category-colors/src/views/category.css.php on line 58
[09-Nov-2022 15:56:58 UTC] PHP Warning:  Undefined array key "%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88-text" in /plugins/the-events-calendar-category-colors/src/views/category.css.php on line 59
[09-Nov-2022 15:56:58 UTC] PHP Warning:  Undefined array key "%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88-background" in /plugins/the-events-calendar-category-colors/src/views/category.css.php on line 75
[09-Nov-2022 15:56:58 UTC] PHP Warning:  Undefined array key "%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88-border" in /plugins/the-events-calendar-category-colors/src/views/category.css.php on line 78
[09-Nov-2022 15:56:58 UTC] PHP Warning:  Undefined array key "%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88-text" in /plugins/the-events-calendar-category-colors/src/views/category.css.php on line 82
[09-Nov-2022 15:56:58 UTC] PHP Warning:  Undefined array key "%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88-text" in /plugins/the-events-calendar-category-colors/src/views/category.css.php on line 83
[09-Nov-2022 15:56:58 UTC] PHP Warning:  Undefined array key "%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88-background" in /plugins/the-events-calendar-category-colors/src/Category_Colors/CSS/Pro.php on line 112

There is a category on this site with its label and slug in Japanese (reads "event"),

image

That katakana slug gets encoded as '%E3%82%A4%E3%83%99%E3%83%B3%E3%83%88', which isn't matching properly when trying to interpolate it into the array keys.

I haven't dug in deeper to propose a solution, apologies, but wanted to flag the issue. We're instructing editors to use ascii characters in labels for now.

afragen commented 1 year ago

Multilingual support has always been touchy. Take a look at https://wordpress.org/support/topic/wpml-support-67/ maybe it'll help.

afragen commented 1 year ago

Though this looks like an issue with how core does something here.

afragen commented 1 year ago

I'm fairly certain that any modifications I make to a term are only safe in Arabic letters. I have no idea how to do manage this with Japanese, etc.

kadamwhite commented 1 year ago

https://github.com/afragen/the-events-calendar-category-colors/pull/137 would mitigate this for us, I am not sure whether colors work properly with non-ascii slugs but the log warnings are the biggest issue for us right now.

afragen commented 1 year ago

I've merged #137, let me know if it also fixes this issue.

kadamwhite commented 1 year ago

137 did address the log warnings, I'm going to close this out as no longer a problem for us.