user-defined block with the given title

mescalito - October 5, 2007 - 17:11
Project:Rep[lacement]Tags
Version:5.x-1.x-dev
Component:Reptag .tags module
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

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!

#1

profix898 - October 5, 2007 - 18:40
Status:active» 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) ...

#2

mescalito - October 5, 2007 - 18:46
Status: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".

#3

profix898 - October 5, 2007 - 23:16
Status:active» fixed

Sorry! Got that wrong. Bugfix committed.

#4

mescalito - October 6, 2007 - 16:30
Status:fixed» reviewed & tested by the community

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"

AttachmentSize
block.tags_.inc_.patch 452 bytes

#5

mescalito - October 12, 2007 - 12:35

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

#6

profix898 - October 12, 2007 - 12:45

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.

#7

mescalito - October 12, 2007 - 15:32

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.

#8

profix898 - October 14, 2007 - 13:47

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?

#9

mescalito - October 14, 2007 - 18:38

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

#10

profix898 - October 15, 2007 - 19:56
Status:reviewed & tested by the community» fixed

No problem. Bugfix committed. Thanks :)

#11

Anonymous - October 29, 2007 - 20:22
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.