[wp-trac] [WordPress Trac] #8553: preg_replace_callback in do_shortcode returns empty for large posts

WordPress Trac wp-trac at lists.automattic.com
Fri Nov 20 22:59:54 UTC 2009


#8553: preg_replace_callback in do_shortcode returns empty for large posts
-------------------------------------+--------------------------------------
 Reporter:  AaronCampbell            |        Type:  defect (bug)
   Status:  new                      |    Priority:  high        
Milestone:  2.9                      |   Component:  Shortcodes  
  Version:                           |    Severity:  normal      
 Keywords:  has-patch needs-testing  |  
-------------------------------------+--------------------------------------

Comment(by Brusdeylins):

 This Problem still exists in WP 2.8.6.
 My solution in ./wp-includes/shortcodes.php :


 {{{
 function get_shortcode_regex() {
   global $shortcode_tags;
   $tagnames = array_keys($shortcode_tags);
   $tagregexp = join( '|', array_map('preg_quote', $tagnames) );

   // defect for long posts
   // return
 '(.?)\[('.$tagregexp.')\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?(.?)';

   // solution for brusdeylins.info
   return '(.?)\[('.$tagregexp.')\b([^\]]*?)(\/)?\](?:(.+?)\[\/\1\])?(.?)';
 }
 }}}

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


More information about the wp-trac mailing list