Fixed Execution timeout when handling image data URLs


Well-known member
XenForo_Helper_Media::_convertMediaLinkToEmbedHtml blindly attempts to convert any text into a media bbcode. This causes ridiculously long execution times if there are a lot of media sites added, and dealing with +20kb of text.

An 2kb length limit is the practical limit to ensure IE compatibility, while most servers max out at 8kb.

The media editor appears to sometimes do this for some people. ie the URL; index.php?editor/media where they paste an entire image (as data:image/jpeg;base64,...) into the URL textbox.
Last edited:


XenForo developer
Staff member
I suppose this depends exactly how many media sites you have (and the regex structure of them), but I have made some tweaks here that should resolve this:
  • If the URL has a protocol but it's not http or https, immediately abort. (If it doesn't have a protocol, we'll assume someone did "" and keep checking.
  • Truncate the URL to 8KB before checking. Certainly longer than should really be necessary, but it appears that IE does support URLs longer than 2KB now and other browsers do too.