I've just encountered an error trying to install the dev version of the Media module, receiving an exception about an undefinied variable $ret in recreateTableKeys inside schema.inc

Taking a peek inside:

  protected function recreateTableKeys($table, $new_keys) {
    if (isset($new_keys['primary key'])) {
      $this->addPrimaryKey($ret, $table, $new_keys['primary key']);
    }
    if (isset($new_keys['unique keys'])) {
      foreach ($new_keys['unique keys'] as $name => $fields) {
        $this->addUniqueKey($ret, $table, $name, $fields);
      }
    }
    if (isset($new_keys['indexes'])) {
      foreach ($new_keys['indexes'] as $name => $fields) {
        $this->addIndex($ret, $table, $name, $fields);
      }
    }
  }

Forgive me if I'm incorrect (I really need to have a decent read-up on php) but it looks like $ret is not defined anywhere yet is passed along to those various methods as the first parameter. Taking a look at these methods indicates that the $ret parameter probably shouldn't be there [?] (for example, addPrimaryKey only has a 2 parameter signature, but we're trying to pass 3).

Simply removing the $ret parameter from each of the 3 calls appears to have fixed it, but again my limited understanding may mean I'm missing something.

Anyway, if this is in fact the issue, I've attached a patch below. Thanks!

CommentFileSizeAuthor
sqlsrv-recreateTableKeys-ret.patch920 bytesCapBBeard

Comments

david_garcia’s picture

Issue summary: View changes
Status: Active » Closed (cannot reproduce)

Fixed long time ago.