Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
I noticed that some characters are urlencoded when pathologic is enabled
for example:
cart/add/p30_q1?destination=cart
are transform to this:
cart/add/p30_q1%3Fdestination%3Dcart
which breaks the url redirection...
If I disable pathologic the url is not encoded and everything works as usual...any ideas?
Regards,
Sebastian
Comments
Comment #1
Garrett Albright CreditAttribution: Garrett Albright commentedHi… Just want to acknowledge that I've seen your message, but I can't quite work on it just yet. Thanks for trying Pathologic, though.
Comment #2
cocoliso CreditAttribution: cocoliso commentedHey Garret thank for the reply and for making this module.
No rush :-)
Comment #3
Garrett Albright CreditAttribution: Garrett Albright commentedHi there. Still trying to use Pathologic and having this problem?
When the next dev release (*not* the beta release… the dev releases on the project page have a red background) is available, please download it and give it a try. It will hopefully fix this problem.
Comment #4
jrosen CreditAttribution: jrosen commentedHi Garrett, I am having this issue with the following URL:
/civicrm/profile/edit&gid=1&reset=1
becoming:
/civicrm/profile/edit%2526amp%3Bgid%3D1%2526amp%3Breset%3D1
I downloaded the latest dev release, but it doesn't seem to fix it. Can you post the new dev release you referred to or at least post a patch or which lines of code to change to fix this.
Thanks.
Comment #5
Garrett Albright CreditAttribution: Garrett Albright commentedYeargh, okay. That's not how I was expecting query strings to look, but I guess it's legitimate. Thanks for noting it.
Comment #6
Garrett Albright CreditAttribution: Garrett Albright commentedAll right, I've committed what may be a fix. The packaging robot should package together a new dev release soon; please give it a try.
Comment #7
Garrett Albright CreditAttribution: Garrett Albright commentedComment #9
meecect CreditAttribution: meecect commentedI'm not sure this is fixed. I am using drupal 6, wysiwyg, tinymce, civicrm and the dev branch of pathologic.
Please read this comment fully. It is long, but the research is solid.
I have a link like this:
This link is inserted via tinyMCE (via wysiwyg). Pathologic seems to mangle the link into this:
After a judicious use of the dpm() function, I have tracked the problem down to this section of code, near line 120:
the problem arises with the parse_str function. This function yields this in $qparts:
You can see that it does not handle an encoded query parameter string; it merely splits on the '&'. This is actually mentioned in a comment on the php manual for parse_str:
http://php.net/manual/en/function.parse-str.php :
Now, some think that the URL string should not have encoded entities in it. Perusing this thread at the tinyMCE forums shows that the tinyMCE developers disagree:
http://www.tinymce.com/forum/viewtopic.php?pid=34821 :
I did not take their word for it though, since it seems odd to encode a URL like that, so I went to the specs.
http://www.w3.org/TR/xhtml1/guidelines.html#C_12 :
The recommended solution is to pass the query string through html_entity_decode() first. On a similar issue in the queue (http://drupal.org/node/1303782), a similar patch was contributed, but at a different place in the code. My solution is to do this:
, as recommended in several forums as a fix for parse_str.
While this works, I'm not sure it is perfect, as it appears (but I'm not sure) that it has the side-effect of essentially undoing the encoding that tinyMCE had done in the first place. I would need to investigate what url() does in more detail to see if it puts the encoding back.
It's a one line change, but I can roll a patch for it if necessary.
Comment #10
Garrett Albright CreditAttribution: Garrett Albright commentedUnfortunately, I'm no longer maintaining the 6.x branch of Pathologic, so any bugs in there are going to stay in there. Sorry.