Title option stops working after multiple replacements

mr.j - April 8, 2009 - 01:46
Project:link node
Version:5.x-1.3
Component:Code
Category:bug report
Priority:critical
Assigned:TomChiverton
Status:closed
Description

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.

AttachmentSize
link_node_patch.txt1.08 KB

#1

mr.j - April 8, 2009 - 01:48

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

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

#2

mr.j - April 8, 2009 - 01:50
Status:needs review» reviewed & tested by the community

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

#3

Summit - April 9, 2009 - 20:07

Subscribingm greetings, Martijn

#4

TomChiverton - April 18, 2009 - 10:25
Assigned to:Anonymous» TomChiverton
Status:reviewed & tested by the community» fixed

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

#5

System Message - May 2, 2009 - 10:30
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.