[wp-trac] [WordPress Trac] #29557: PHP ≤ 5.4.8 Crashes on '[' Character in Posts

WordPress Trac noreply at wordpress.org
Tue Sep 30 22:10:40 UTC 2014


#29557: PHP ≤ 5.4.8 Crashes on '[' Character in Posts
-----------------------------------+--------------------
 Reporter:  MrBobDobolina          |       Owner:
     Type:  defect (bug)           |      Status:  new
 Priority:  highest omg bbq        |   Milestone:  4.0.1
Component:  Formatting             |     Version:  4.0
 Severity:  blocker                |  Resolution:
 Keywords:  wptexturize has-patch  |     Focuses:
-----------------------------------+--------------------

Comment (by azaozz):

 Looking at the patches here and wondering: would it be better to do a
 double preg_split()? Something like:

 {{{
 if ( strpos( $text, '[' ) !== false && strpos( $text, ']' ) !== false ) {
   $has_shortcodes = true;
   $textarr = preg_split( '/generic shortcode regexp/', $text, ... );
 } else {
   $textarr = array( $text );
 }

 foreach ( $textarr as &$part ) {
   if ( ! $has_shortcodes || not a shortcode ) {
     $split = preg_split( '/<.[^>]*>/', $part, etc... );
     foreach ( $split as &$chunk ) {
       // Process the text and tags
     }
   }
 }
 }}}

 This will make the regexp simpler, remove a lot of backtracking, prevent
 cases like in [#comment:68 comment 68], and bypass tags in shortcode
 attributes.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/29557#comment:80>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list