[wp-trac] [WordPress Trac] #19855: Too much text in <pre> tag causes no output

WordPress Trac wp-trac at lists.automattic.com
Thu Jan 19 12:24:36 UTC 2012


#19855: Too much text in <pre> tag causes no output
--------------------------+------------------------------
 Reporter:  helenyhou     |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Formatting    |     Version:  1.2
 Severity:  normal        |  Resolution:
 Keywords:                |
--------------------------+------------------------------
Changes (by AdamBackstrom):

 * cc: adam@… (added)


Comment:

 This is affected by the `pcre.backtrack_limit` in php.ini. The default in
 PHP < 5.3.7 was 100000, and in PHP 5.3.7 they increased limit 10x, which
 is still 10x lower than PCRE internal defaults.

 You observe the limit with this bit of code:

 {{{
 function clean_pre($matches) {
         return $matches[1] . $matches[2] . "</pre>";
 }

 $pee = '<pre>' . str_repeat( 'a', 99995 ) . '</pre>';

 ini_set( 'pcre.backtrack_limit', 100000 ); // php < 5.3.7 default
 $pee = preg_replace_callback('!(<pre[^>]*>)(.*?)</pre>!is', 'clean_pre',
 $pee );
 var_dump( null == $pee );

 ini_set( 'pcre.backtrack_limit', 99999 );
 $pee = preg_replace_callback('!(<pre[^>]*>)(.*?)</pre>!is', 'clean_pre',
 $pee );
 var_dump( null == $pee );
 }}}

 See also: PHP [https://bugs.php.net/bug.php?id=40846 Request #40846
 pcre.backtrack_limit too restrictive]. Both #8553 and #15600 reference the
 backtrack limit in relation to shortcodes.

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


More information about the wp-trac mailing list