There exists request_path() in the API docs, don't use $_REQUEST['q'] because on some server configurations it will return false/empty, always use request_path() instead for getting the original request

http://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/reque...

http://example.com/path/alias (which is a path alias for node/306) returns "path/alias" as opposed to the internal path.

Otherwise you may get some loops occuring because it's not checking the right value

CommentFileSizeAuthor
#1 1834366-request-path.patch3.02 KBdgtlmoon
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dgtlmoon’s picture

FileSize
3.02 KB
jm.federico’s picture

Status: Active » Fixed

This has been fixed already

Cheers

dgtlmoon’s picture

Status: Fixed » Active

Wrong, patch still applies

jm.federico’s picture

@dgtlmoon

I'm sorry if I ofended you with the way my comment was posted, but I feel telling someone that one is wrong with no further explanation of why one is wrong is a bit rude.

As per the "wrong", I insist, it has been fixed.
I think you are looking at the master branch and nod the 7.x-1.x branch.
Last update to master was 20 months ago, last update to 7.x-1.x was 5 weeks ago.

Indeed, master branch is still using $_REQUEST['q'] in many places, but that branch is not used for any releases.

Cheers

jm.federico’s picture

Status: Active » Fixed
dgtlmoon’s picture

Aaah my mistake! all good then, yeah its confusing with these master branches, i've made that mistake myself also, is it possible to empty/delete it? not real clear how that works here

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Greg__’s picture

Issue summary: View changes
Status: Closed (fixed) » Active

I got an infinite loop because my $_REQUEST['q'] was empty.
The globalredirect_request_path function always return an empty path :

function globalredirect_request_path() {
  if (request_uri()) {
    if (isset($_REQUEST['q'])) {
      $path = $_REQUEST['q']; // Return empty
    }
...

And this cause an infinite loop because of this code in the globalredirect_init function :

if ($request_path != $prefix . $alias) { // Request_path is empty due to the function above so it's never equal to $prefix . $alias
    if (str_replace($prefix . $alias, '', $request_path) != '/' || $settings['deslash']) {
      globalredirect_goto($alias, $options); // And redirecting to the same page over and over again
    }
  }

So idon't know about your branch but the actual dev and stable module still have the $_REQUEST['q'].

FYI I stopped this loop by changing the testing condition of $_REQUEST['q'] (until a better fix) :

function globalredirect_request_path() {
  if (request_uri()) {
    if (isset($_REQUEST['q']) && !empty($_REQUEST['q'])) {
      $path = $_REQUEST['q'];
    }
...
RavindraSingh’s picture

Status: Active » Closed (fixed)

Tested, it is already fixed in 7.x-1.5 release. So closing this issue.