Make WordPress Core

Opened 4 years ago

Last modified 4 years ago

#51377 new defect (bug)

Front End elements break after too many shortcodes

Reported by: ghostofharambe's profile ghostofharambe Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.1.1
Component: Shortcodes Keywords: reporter-feedback
Focuses: Cc:


I recently joined a wordpress project to try to fix some issues with the code. This project uses around 1000 different shortcodes and at somewhere in the middle of the development of these shortcodes when an addition was made the Front-End elements will disappear. After some testing and debugging i was able to add many more shortcodes with reducing the length of the $tag parameter of the "add_shortcode()" method. This drew me to the conclusion that there is a limitation of the offset of the summation of all shortcodes' $tags Strings in the whole WordPress installation. Is this a viable conclusion or is there something more to it? Please let me know as i need to proceed with this.

Enjoy your day and thank you.

Change History (3)

#1 @garrett-eclipse
4 years ago

  • Component changed from General to Shortcodes
  • Focuses performance privacy coding-standards removed
  • Keywords dev-feedback reporter-feedback has-dev-note needs-testing removed

#2 @SergeyBiryukov
4 years ago

  • Keywords reporter-feedback added

Hi there, welcome to WordPress Trac! Thanks for the report.

Could you provide a list of steps to reproduce the issue on a clean install?

#3 @ghostofharambe
4 years ago

Hi there, thanks for the quick reply.

It's a plugin that has multiple pages which each one has a shortcode inside that calls a specific function in a file that does similar actions with all the rest shortcode functions.

The issue first occurred when we added many new add_shortcode() and we thought there was a limit with the shortcodes created in the whole installation, because at the removal of one shortcode function and references the Front-End was restored (previously some elements will not appear).

After some debugging and enabling the DEBUG mode of wordpress a warning message appear telling that the offset from preg_match() has reached its limit.

Then i tried adding a shortcode with $tag length value n (n=1,2,3.....1000) and the issue appeared again when the $tag reached a certain length.

From my testing and perspective i reached the conclusion that there is a limit to the overall $tag value of the add_shortcode() function.

I hope this was helpfull, please let me know if i can enlist any more details.

Thank you and take care

Note: See TracTickets for help on using tickets.