I have 2 websites on the same server. They both use the same modules.

In one of them, I get the following notices:

Notice: Undefined index: q in current_path() (line 355 of /var/www/drupal/includes/path.inc).
Notice: Undefined index: q in l() (line 2424 of /var/www/drupal/includes/common.inc).
Notice: Undefined index: q in arg() (line 2792 of /var/www/drupal/includes/bootstrap.inc).

Does anyone have any idea about what can cause these notices?
The website is working perfectly, and I know I can put some error_reporting in the settings.php, but it won't solve the problem.

  • What version of Drupal?
    – user4035
    Mar 24, 2013 at 7:37
  • Sorry, drupal 7.21
    – Bnayal
    Mar 24, 2013 at 11:01
  • Do you have any URL rewriting module or htaccess rules added ?
    – AKS
    Mar 24, 2013 at 20:53
  • I have Boost (with htaccess rules. works perfect) and Redirect modules active.
    – Bnayal
    Mar 25, 2013 at 8:44

2 Answers 2


Line 355 of /includes/path.inc contains this code:

return $_GET['q'];

So, we can suppose, that $_GET['q'] is undefined. According to documentation, this variable is initialized in drupal_path_initialize function during bootstrap. It's code:

function drupal_path_initialize() {
  if (empty($_GET['q'])) {
    $_GET['q'] = variable_get('site_frontpage', 'node');
  $_GET['q'] = drupal_get_normal_path($_GET['q']);

Maybe, the function drupal_get_normal_path gives undefined value for 'site_frontpage' var?

  • I have changed drupal_path_initialize to include the following code at the end: <?php if(empty($_GET['q'])){ watchdog('check','empty'); } ?> But it's never empty in this function. it always contains good value.
    – Bnayal
    Mar 28, 2013 at 8:01
  • do you still get this error: Undefined index: q in current_path() (line 355 ?
    – user4035
    Mar 28, 2013 at 9:50
  • As I wrote earlier, that was a stupid mistake I made somewhere in the theme unset($_GET['q']) for some stupid reason. Thanks for the help!
    – Bnayal
    Mar 28, 2013 at 12:46

Never mind, That was a stupid mistake of mine in my custom theme.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.