[wp-trac] [WordPress Trac] #41791: Unicode + add_permastruct breaks rewrite rules

WordPress Trac noreply at wordpress.org
Mon Sep 4 11:15:59 UTC 2017


#41791: Unicode + add_permastruct breaks rewrite rules
---------------------------+-----------------------------
 Reporter:  mikejolley     |      Owner:
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Rewrite Rules  |    Version:  trunk
 Severity:  normal         |   Keywords:
  Focuses:                 |
---------------------------+-----------------------------
 This was reported here
 https://github.com/woocommerce/woocommerce/issues/16673

 To recreate the issue, create a taxonomy with a cyrillic name such as
 Сертификат. View the taxonomy archive. You'll see no results; it will go
 to the homepage rather than an archive.

 In WooCommerce you can recreate this by creating an attribute (Product >
 Attributes) with a cyrillic name, and enabling the 'archive', assigning a
 term from this taxonomy to a product, and trying to view products by that
 term.

 I managed to trace it back to the `add_permastruct`. The `struct` is added
 with unicode % encoded characters. When the rewrite rules are processed,
 it thinks these are placeholders so the `matches` variables do not align.
 See this screenshot for clarity:

 https://www.dropbox.com/s/5vztnfm6895488a/query%20is%20wrong.png?dl=0

 Notice all the $matches? Compare to a working taxonomy:

 https://www.dropbox.com/s/24zyr5v7taw7b60/correct.png?dl=0

 This can be fixed by using `urldecode` when adding the permastruct. I
 don't know if this has side effects but it worked in testing.

 Patch to follow.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/41791>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list