The comment above drupal_parse_url() reads:

This function should only be used for URLs that have been generated by the
system, such as via url(). It should not be used for URLs that come from external sources, or URLs that link to external resources.

Rules has no way of knowing whether a page redirect's URL is system-generated or not, so the use of drupal_parse_url() should be dropped entirely.

The current logic can cause unexpected results. For example, drupal_parse_url() may munge the query string of an external URL.

Comments

TR’s picture

Issue summary: View changes
Status: Active » Closed (works as designed)

Actually, the documentation on drupal_parse_url() was wrong - it's perfectly fine to use for external URLs. The documentation was corrected by #2277623: UrlHelper::parse()/drupal_parse_url needs documentation update.

If drupal_parse_url() is doing the wrong thing with the query string, then that's a core issue. I suspect you encountered something like https://api.drupal.org/comment/56813#comment-56813 ?