• I’ve got xdebug installed and it outputs the trace which will include the args of called functions.

    This is causing a recursion loop when an error occurs in the output of a shortcode, as the shortcode itself is outputted as the arg of the trace.

    Give this the result of a shortcode could be returned by accident and personally I cannot think of any reason to have recursion via the shortcodes.
    Could the shortcode processor keep track of the parent code(s) and not process them if they appear in the shortcode output

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    Well, don’t let any errors occur then ??

    But seriously, instead of messing with the processor, I think it’d be better to pre-process the output to somehow escape the shortcode in debug output so that it is not picked up by the processor to start with. Converting square brackets only in debug output into HTML entities might be a way to escape shortcodes.

    The challenge will be to pre-process output after debug output but before shortcode processing. The correct priority arg for the “the_content” filter should do the trick, but I’m unsure of how/when debug output happens. In any case some sort of output buffering and selective escaping should work.

    Thread Starter David Goring

    (@dg12345)

    My own fix will likely be to use the shortcode filters to disable and enable aspects of xdebug, before and after the shortcode has run

    html entities are unlikely to work as the shortcode processor looks for escaped square brackets.

    However my reason for adding it here is that it should not be able to cause a recursion loop ever, whether its from a error report of from someone outputting content

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Shortcode Recursion’ is closed to new replies.