[buddypress-trac] [BuddyPress Trac] #6517: bp_create_excerpt returning mall-formed markup - mb_strlen issues?

buddypress-trac noreply at wordpress.org
Tue Jun 23 07:27:54 UTC 2015


#6517: bp_create_excerpt returning mall-formed markup - mb_strlen issues?
------------------------------+--------------------
 Reporter:  hnla              |       Owner:
     Type:  defect (bug)      |      Status:  new
 Priority:  normal            |   Milestone:  2.3.3
Component:  Component - Core  |     Version:
 Severity:  normal            |  Resolution:
 Keywords:                    |
------------------------------+--------------------

Comment (by hnla):

 Yes your test case works (ok so rounds down, would have to really )

 But now add an anchor into the mix as currently that test case doesn't
 cover all the perms
 ''$totalLength == 18''

 {{{
 bp_create_excerpt( 'foo <a>bar</a> baz', 5, array( 'exact' => true, 'html'
 => false ) );

 //  'html' is false so include tag count
 // 'exact' is true so return literal string length

 //  returns 'foo <'

 // Result returns parsed markup as character data.
 // Result not as expected?
 // We need to strip tags from an literal count of characters if including
 markup in count
 // lest we land on a portion of that markup inadvertently?
 }}}

 {{{
 bp_create_excerpt( 'foo <a>bar</a> baz', 5, array( 'exact' => true, 'html'
 => true ) );

 //  returns 'foo b'

 // Result as expected; 5 characters wanted 'exact' is true, markup is
 removed from count
 // so we have first character of second word rendered (wrapped in it's
 anchor though!)

 }}}

 {{{
 bp_create_excerpt( 'foo <a>bar</a> baz', 6, array( 'exact' => false,
 'html' => false ) );

 //  returns 'foo'

 //  'html' is false so include tag count
 // 'exact' is false so don't cut mid-word

 // Result as expected; 6 characters counted up to '<a' result rounded down
 to first word boundary end.


 }}}

--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/6517#comment:15>
BuddyPress Trac <http://buddypress.org/>
BuddyPress Trac


More information about the buddypress-trac mailing list