[wp-trac] [WordPress Trac] #21013: Badly truncated slugs in posts with similar, long non-latin titles

WordPress Trac wp-trac at lists.automattic.com
Mon Jun 18 21:32:06 UTC 2012


#21013: Badly truncated slugs in posts with similar, long non-latin titles
----------------------------------------+------------------
 Reporter:  nevma                       |       Owner:
     Type:  defect (bug)                |      Status:  new
 Priority:  normal                      |   Milestone:  3.5
Component:  Permalinks                  |     Version:  3.4
 Severity:  normal                      |  Resolution:
 Keywords:  has-patch needs-unit-tests  |
----------------------------------------+------------------

Comment (by SergeyBiryukov):

 [attachment:21013.patch] didn't work for two reasons:
 1. When we run the query to check if the slug already exists,
 `$alt_post_name` should be urlencoded.
 2. The decoded string is shorter than 200 characters, so the slug wasn't
 truncated. We would need a compat version of `mb_strlen()` as well.

 [attachment:21013.2.patch] fixes that. The compat `mb_strlen()`
 implementation is based on `mb_substr()` code: [[BR]]
 http://core.trac.wordpress.org/browser/tags/3.4/wp-includes/compat.php#L16

 [attachment:21013.3.patch] adds `rtrim( $alt_post_name, '-' )`, in case
 the string we get ends with a hyphen:
 {{{
 предлагаем-металлообрабатывающее--2
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/21013#comment:5>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list