Notice: Undefined variable: info in: -> dbtuner_empty_index() within the file dbtuner.admin.inc

Faulting Function: dbtuner_empty_index()

The current use of return trim($info['Key_name']) is 'simply' incorrect!
It is not possible to get that from the given code use within; dbtuner_empty_index()!

Tracing the 'intended' use within the function dbtuner_empty_index($table, $index),
I would derive that you intended use the return value thus;

return trim($column_name['Key_name']);

-but *not* as the original:
return trim($info['Key_name']),
that does not exist!

*Suggested Fix / Patch:*

    // Find the indexes that only contain 1 key_name in it
    foreach ($table_info as $columns) {
      $counter = 0;
      $match = FALSE;
      foreach ($columns as $column_name) {
        $counter++;
        if ($column_name == $index) {
          $match = TRUE;
        }
      }
      // Index exists
      if ($match && $counter == 1) {
-        return trim($info['Key_name']);
+        return trim($column_name['Key_name']);
      }
      // Index exists but is appart of a multi index;
      // these are not supported at this time
      elseif ($match) {
        return FALSE;
      }
    }

Suggestion: Drupal Developers / Coders *are* encouraged to use PHP's E' Notice for debugging + production releases.

Simply said, I am finding such *bugs* often. Just check my posts here @ Drupal :)
Notes: some E' notices are 'harmless' and poor use of code, others are real 'bugs'!

Comments

Peter Bowey’s picture

Status: Active » Needs review
avpaderno’s picture

Priority: Major » Normal
Status: Needs review » Closed (outdated)
Issue tags: -Undefined variable: info in dbtuner_empty_index() dbtuner.admin.inc

I am closing this issue, since it's for a Drupal version no longer supported.