[wp-trac] [WordPress Trac] #32775: wptexturize breaks if too many shortcode

WordPress Trac noreply at wordpress.org
Wed Jun 24 08:53:29 UTC 2015


#32775: wptexturize breaks if too many shortcode
--------------------------+-----------------------------
 Reporter:  odoremieux    |      Owner:
     Type:  defect (bug)  |     Status:  new
 Priority:  normal        |  Milestone:  Awaiting Review
Component:  General       |    Version:  4.2.2
 Severity:  normal        |   Keywords:
  Focuses:                |
--------------------------+-----------------------------
 wptexturize breaks depending on the number of the shortcode and the length
 of the shortcode name.

 The error I'm getting is :
 PHP Warning:  preg_split(): Compilation failed: regular expression is too
 large at offset 33012


 Here is some code that can reproduce it


 {{{
 <?php

 /*
  * Plugin Name:   Test ShortCodes
  * Version:       1.01.01
  * Plugin URI:
  * Description:   Test ShortCodes
  * Author:
  * Author URI:
  *
  */

 if (!class_exists("Test_ShortCodes")) {

     class Test_ShortCodes {

         function Test_ShortCodes() {
             global $shortcode_tags;
             error_log('Before ShortCode -> ' . count($shortcode_tags));

             for ($x = 0; $x <= 200; $x++) {
 add_shortcode('mysimpleshortcodewidthsomelongtextintthenametodosometestingandseeifitbreaksmaybeweneedmoretexttotestevenalittlebitmorejustincaseorisitmaybetoolongmaybemaybenot_'
 . $x, array(&$this, 'testfunction_ShortCode'));
             }
             error_log('After ShortCode -> ' . count($shortcode_tags));
         }

         function testfunction_ShortCode($atts, $content = null) {

         }

     }

 }

 $myTest_ShortCodes = new Test_ShortCodes();
 ?>
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/32775>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list