Title option stops working after multiple replacements
| Project: | link node |
| Version: | 5.x-1.3 |
| Component: | Code |
| Category: | bug report |
| Priority: | critical |
| Assigned: | TomChiverton |
| Status: | closed |
Jump to:
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.
| Attachment | Size |
|---|---|
| link_node_patch.txt | 1.08 KB |

#1
agh should have previewed .. it should read ...
the difference being that it checks for the html encoded " sequence instead of a " character
#2
Oh and I've applied on my production box and confirmed that it works.
#3
Subscribingm greetings, Martijn
#4
Drupal 5 v1.4 released with patch. Drupal 6 version already had this fix.
#5
Automatically closed -- issue fixed for 2 weeks with no activity.