From #759844: Overlay does not work with prefixed URL paths [catch]:

There are various issues with hook_url_outbound_alter() and hook_url_inbound_alter() - notably the inability to tell what's happened to paths without running the hooks again in most cases too.

I was looking at the D7 port of globalredirect recently, and that's pretty much broken if anything implements hook_url_inbound_alter() too

One of the main consequences of this is that we are unable to know which is the current URL prefix without calling url() and thus running all the hook_url_outbound_alter() implementations.

CommentFileSizeAuthor
#8 drupal.url-alter-backup.8.patch756 bytessun

Comments

sun’s picture

Sounds quite hypothetical to me, although it also scratches the surface of possible issues, of course. But still, to deserve a critical priority, we need an actual problem here.

plach’s picture

IMO there is nothing hypothetical in being unable to tell which is the current path prefix, if any.

sun’s picture

Sure thing, I completely understand. However, I'm also aware of this problem since Drupal 5, err, ever?

We can certainly backup the original request path/parameters somewhere in $_REQUEST or $GLOBALS, prior to invoking hook implementations, but that's not the end of the world...

catch’s picture

Priority: Critical » Normal

I think Sun's right, it's not a new problem (global_redirect module also re-invokes the Drupal 6 equivalents, it's just worse in D7), so I'm downgrading to normal - it's a (lot of if you run into it) annoyance rather than complete breakage. I think backing up the path is a good plan.

plach’s picture

Priority: Normal » Major

I think Sun's right, it's not a new problem (global_redirect module also re-invokes the Drupal 6 equivalents, it's just worse in D7

Major?

plach’s picture

sun’s picture

Status: Active » Needs review
StatusFileSize
new756 bytes

I'm not sure whether I fully understand this issue, but here's a patch for starters.

It's relatively tough to find a safe + valid place to backup the original value. Also, not sure whether $_REQUEST['q'] still contains the original, unaltered path?

Status: Needs review » Needs work

The last submitted patch, drupal.url-alter-backup.8.patch, failed testing.

sun’s picture

whuzzup? Did we reveal some code that's not safe against raw $_GET values here?

sun.core’s picture

Since we changed D7 to no longer have $_GET['q'], this clearly sounds like a regression to me.

Perhaps, instead of that fake __q GET parameter, we should restore sanity and put it into $_REQUEST['q']? That would actually restore full backwards-compatibility with D6 and below.

sun’s picture

plach’s picture

Yes, I was thinking to something about it too. We can compare the original request and the current system path and compute at least the current URL path prefix.

chx’s picture

Title: No way to know what hook_url_*_alter() are doing without invoking them again » hook_inbound_alter breaks the module
Project: Drupal core » Global Redirect
Version: 7.x-dev » 7.x-1.x-dev
Component: base system » Code

I have verified that request_path() contains the original request path: it's called before settings.php is loaded and the path is static cached unresetable so it will always contain the original path. Take it from here.

joelstein’s picture

Subscribing.

thebuckst0p’s picture

Subscribe

wmostrey’s picture

Title: hook_inbound_alter breaks the module » hook_url_inbound_alter breaks the module

I'm looking into this, along with #774950: Incompatible with hook_url_inbound_alter().

wizonesolutions’s picture

wmostrey: Any findings?