Bellow is a patch to a bug I found in field_sql_storage.module at function field_sql_storage_field_storage_details(). (my first patch, so tell me if I did it right... :-)

Simple matter of instantiating an array variable before adding values to it. This is a case of instantiating the wrong variable. Should be $columns = array() instead of $details = array().

This bug was causing one of my fields (only one, and not all, which seems odd) to throw an error on the node edit page.

Notice: Undefined variable: columns in field_sql_storage_field_storage_details() (line 689 of /Users/www/care.dev.local/modules/field/modules/field_sql_storage/field_sql_storage.module).
Notice: Undefined variable: columns in field_sql_storage_field_storage_details() (line 692 of /Users/www/care.dev.local/modules/field/modules/field_sql_storage/field_sql_storage.module).

Comments

manimejia’s picture

Title: Documentation problem with field_sql_storage_field_storage_details » Wrong array instantiated in field_sql_storage_field_storage_details()

Status: Needs review » Needs work

The last submitted patch, field_sql_storage.field_storage_details.columns_array.diff, failed testing.

manimejia’s picture

Really should be fixed. Sorry about the faulty patch. Just take a look bellow and you will see ... $details = array(); should be $columns = array(); ... pretty obvious :

function field_sql_storage_field_storage_details($field) {
  $details = array();
  if (!empty($field['columns'])) {
     // Add field columns.
    foreach ($field['columns'] as $column_name => $attributes) {
      $real_name = _field_sql_storage_columnname($field['field_name'], $column_name);
      $columns[$column_name] = $real_name;
    }
    return array(
      'sql' => array(
        FIELD_LOAD_CURRENT => array(
          _field_sql_storage_tablename($field) => $columns,
        ),
        FIELD_LOAD_REVISION => array(
          _field_sql_storage_revision_tablename($field) => $columns,
        ),
      ),
    );
  }
}
Jackinloadup’s picture

StatusFileSize
new847 bytes

This is only a patch to the issue stated above. It seems to fix my issue. I didn't do extensive testing.

Jackinloadup’s picture

Status: Needs work » Needs review
mr.baileys’s picture

Status: Needs review » Closed (duplicate)