Closed (fixed)
Project:
Footnotes
Version:
6.x-2.5
Component:
Better URL Filter
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
19 Dec 2010 at 07:38 UTC
Updated:
29 Jan 2011 at 17:47 UTC
Today I was testing adding an AdSense block by directly copying the AdSense code. Your current code does not properly handle this case. I'm not too sure why you expect to have text/tag entries after you called the preg_split() functions, but that's not working as you would expect... The result parsing this code is that the 2nd <script> src="..." attribute is modified. Not good!
<script type="text/javascript"><!--
google_ad_client = "ca-pub-1468496461106527";
/* New */
google_ad_slot = "8261952636";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script><script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
Comments
Comment #1
AlexisWilke commentedI guess I should test, but it seems to me that the only thing you need to do is remove the $chunk_type test.
Also, it seems to me that the preg_match() should use ^ and $ since the entire entry should match the tag.
Another small change you could make (A good optimization, maybe?). In the following, you have the /i flag. I think it's not only useless, it may make the tests a little slower (although we don't test any characters that would require upper/lower case, so I dunno. None-the-less, it is not necessary.)
Thank you.
Alexis Wilke
Comment #2
hingo commentedYes, I think the regexp misses tags that contain a line break. This is a bug. (I remember catching something similar when we did the Drupal 7 URL filter.)
Comment #3
AlexisWilke commentedHo! That's right that the 2nd script has a new line. Note that the comment is also taken as a tag (since it starts/ends with < and >) and it includes new-line characters.
Comment #4
hingo commentedYes, comments are also handled (or rather not handled :-) correctly. Actually, there is a problem if inside a comment you have a > character. We fixed this in the Drupal 7 version so that comments are ignored first, and then all other tags, but I haven't fixed it in this one and might ignore it as long as nobody complains :-)
The fix to the regexp is now committed. A 6.x-2.5 version is imminent.
Btw, thanks for filing many good bug reports!
Comment #5
AlexisWilke commentedWell... I was complaining here... 9-) he! he!
Thank you for keeping up with your module!
Comment #6
HenryLTV commentedHas this fix been confirmed for 6.x-2.5? My code tags do not get ignored and the links inside the code tags get converted to clickable links.
For example, if I post the following (spaces for the code tag are just so they appear in this post):
or even if there are no line breaks:
< code ><tag src="http://www.example.com"></tag>< /code >the URL gets converted to a hyperlink.
After reading the code, I agree with @AlexisWIlke
Everything else about Better URL Filter seems to be doing great tho! Any help on this matter would be greatly apreciated!
Thanks Hingo for the much improved URL Filter!
Comment #7
hingo commentedYour own comment already provides a clue that your problem has nothing to do with this bug, which is precisely about the line breaks :-)
Honestly, I have no idea what your problem is. Just the url in the tag alone:
...should never be converted by better url filter, and this has been like that in any version of url filter I ever published.
The code tag then additionally means that even if you insert a plain url:
...that wouldn't be converted either.
My best guess is you are simply not using url filter. In any case, please don't post to this thread (open a new issue) as your problem is unrelated.
Comment #8
hingo commentedTo be precise: My guess is that you are not using Better URL Filter but are in fact using the builtin URL filter.