If I use such a string:
{BLOCK:block_1}{YOUTUBE:video_id}{BLOCK:block_2}

I get this error message:

    * warning: Invalid argument supplied for foreach() in /path/to/drupal/modules/reptag/tags/block.tags.inc on line 47.

I worked around by commenting the line:
"#{BLOCK:(.*?):(.+?)}#e" => "theme('block', (object)_reptag_block_by_title('\\2','\\1'));",
in block.tags.inc, but that's not a patch!

CommentFileSizeAuthor
#4 block.tags_.inc_.patch452 bytesmesca

Comments

profix898’s picture

Status: Active » Closed (won't fix)

{BLOCK:block_2} is not a valid syntax. It should be {BLOCK:block:2} or stg. (see _reptag_block_help() for sample syntax) ...

mesca’s picture

Status: Closed (won't fix) » Active

Sorry if I wasn't clear. I was referring to the {BLOCK:Contact Details} syntax, which calls a "user-defined block with the given title".

profix898’s picture

Status: Active » Fixed

Sorry! Got that wrong. Bugfix committed.

mesca’s picture

Status: Fixed » Reviewed & tested by the community
StatusFileSize
new452 bytes

Thanks, but your fix is not perfect, and sometimes it catches too much.
Here is a patch for the latest version of block.tags.inc. I simply replaced your regexp:
"#{BLOCK:([^:]+):(.+?)}#e"
by:
"#{BLOCK:([^:!}]+):(.+?)}#e"

mesca’s picture

Hi profix,
Do you plan to commit the patch I sent? Do you have any chance to test it?

profix898’s picture

Missed that completely! Sorry! I'm quite busy at work and updating my modules.
Could you post a list of strings to test against? That would be great :) I'm talking about cases currently failing and those to check all four regexp syntaxes with.

mesca’s picture

I've tested the following strings:

{BLOCK:test block}{YOUTUBE:un_PjRXV5l8}{BLOCK:test block 2}
{BLOCK:1}{YOUTUBE:un_PjRXV5l8}{BLOCK:2}
{BLOCK:block:test block}{YOUTUBE:un_PjRXV5l8}{BLOCK:block:test block 2}
{BLOCK:block:1}{YOUTUBE:un_PjRXV5l8}{BLOCK:block:2}
{BLOCK:test block}{YOUTUBE:un_PjRXV5l8}{BLOCK:block:2}
{BLOCK:block:1}{YOUTUBE:un_PjRXV5l8}{BLOCK:test block 2}

In some cases (when there was more than one tag in the same line and the first one has more than one argument) it was failing because the regexp didn't stop at the first '}'. My submitted patch solves that issue.

profix898’s picture

But what is the ! needed for? Why is it necessary to stop at the next !? {BLOCK:([^:}]+):(.+?)} should solve the problem of a series of tags being incorrectly treated as one, not?

mesca’s picture

Hmmm... you're absolutely right. The ! is needed for nothing! Mea culpa.

profix898’s picture

Status: Reviewed & tested by the community » Fixed

No problem. Bugfix committed. Thanks :)

Anonymous’s picture

Status: Fixed » Closed (fixed)