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

buddypress-trac noreply at wordpress.org
Tue Jun 23 13:31:03 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 boonebgorges):

 > The greatest trick the devil ever pulled was convincing the world that
 reg expressions were cool

 Save your scorn for a time when regular expressions are actually part of
 the problem :)

 {{{
 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?
 }}}

 No, I think this is incorrect. `html=false` implies that the input should
 be treated as a simple string - we should not be doing any parsing of it.
 If a developer chooses to combine `exact=true` with `html=false`, that's
 their prerogative. I can imagine situations where someone might want to
 use this function to get an exact-length excerpt (for reasons other than
 display within a web page).

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


More information about the buddypress-trac mailing list