Bio module frequent logging of PHP Notice: Undefined index

tborrome - February 3, 2009 - 04:06
Project:Bio
Version:5.x-1.2
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:duplicate
Description

I keep getting the following error in the Apache log files:
PHP Notice: Undefined index: q in /persistent/html/pilot.01/sites/all/modules/bio/bio.module on line 28

might not be a big issue functionally, but this may cause performance problems. This error gets logged every user access.

#1

torgosPizza - February 11, 2009 - 18:35

I am getting this as well. Here's what I did to fix it (this is how it is handled in the Secure Pages module). (The first line is the only line I added, then I changed the conditional to follow suit:

(within function bio_init())

<?php
  $path
= isset($_GET['q']) ? $_GET['q'] : '';
  if (
$path == 'node/add/'. bio_get_type()) {
    if ((
$nid = bio_for_user()) && !user_access('administer nodes')) {
     
drupal_goto('node/'. $nid .'/edit');
    }
  }
?>

#2

bflora - March 5, 2009 - 07:08

Can you explain this a bit more? This is what my bio_init function looks like:

function bio_init() {
// TODO: This interferes with aggressive caching. Can we do this in
// hook_menu() instead? Looks like we'd need to make bio follow after node.
// Could cause problems w/ registration and/or CRUD functions.

// Don't allow non-admin users to create more than one bio.
if ($_GET['q'] == 'node/add/'. bio_get_type()) {
if (($nid = bio_for_user()) && !user_access('administer nodes')) {
drupal_goto('node/'. $nid .'/edit');
}
}
}

I'm using the 5.0.x-dev version. What do I change about this to get these errors to stop showing up?

#3

bflora - March 13, 2009 - 23:38

Bump.

#4

Allie Micka - April 11, 2009 - 01:34
Status:active» duplicate

Please see #214141 for updates on this.

Thanks :)

 
 

Drupal is a registered trademark of Dries Buytaert.