There is a serious flaw in the loop when matching the replacement parameters in link_node tags. I was finding that replaced titles were working fine at the top of my pages, but sometimes they would not replace near the bottom - instead printing the full node title instead.

There are 2 regular expressions which match the parameter format part of the link_node tag i.e. ,title="New title"

If the first expression does not match, then the second is used, the difference being that it checks for the html encoded " sequence instead of a " character (I assume this is in case the html filter has already been run).

The problem is that when the first regex fails to match, the 2nd is used instead. However it never resets to using the first regex on the next iteration of the loop. So, end result is if you have a sequence of link_node tags in your page like so:

[node:1,title="Title1"]
[node:2]
[node:3,title="Title3"]

Then the 3rd node will not use the replaced title, because the 2nd regex is set when scanning the node 2 tag, and it is never reset.

The patch for the fix is attached.

CommentFileSizeAuthor
link_node_patch.txt1.08 KBmr.j

Comments

mr.j’s picture

agh should have previewed .. it should read ...

the difference being that it checks for the html encoded " sequence instead of a " character

mr.j’s picture

Status: Needs review » Reviewed & tested by the community

Oh and I've applied on my production box and confirmed that it works.

summit’s picture

Subscribingm greetings, Martijn

TomChiverton’s picture

Assigned: Unassigned » TomChiverton
Status: Reviewed & tested by the community » Fixed

Drupal 5 v1.4 released with patch. Drupal 6 version already had this fix.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.