Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Just minor bug caused by #1003788: PostgreSQL: PDOException:Invalid text representation when attempting to load an entity with a string or non-scalar ID. Found in the latest release Drupal 7.37.
<?php
function drupal_schema_field_types($table) {
$table_schema = drupal_get_schema($table);
foreach ($table_schema['fields'] as $field_name => $field_info) {
$field_types[$field_name] = isset($field_info['type']) ? $field_info['type'] : NULL;
}
return $field_types;
}
?>
$field_types should be defined before foreach ( ... ).
Comment | File | Size | Author |
---|---|---|---|
#1 | 2494403-7.x-field-types.patch | 434 bytes | anydigital |
Comments
Comment #1
anydigital CreditAttribution: anydigital as a volunteer commentedAttaching the patch.
Comment #2
stefan.r CreditAttribution: stefan.r commentedpatch looks good
Comment #3
stefan.r CreditAttribution: stefan.r commentedAs the actual warnings are:
Warning: Invalid argument supplied for foreach() in drupal_schema_field_types() (line 7151 of /includes/common.inc).
Notice: Undefined variable: field_types in drupal_schema_field_types() (line 7154 of /includes/common.inc).
Warning: array_keys() expects parameter 1 to be array, null given in drupal_schema_fields_sql() (line 7171 of /includes/common.inc).
From David_Rothstein, this actually only fixes the notice and not the warnings:
Comment #4
matthandI experience this error on a fresh install that is also running the contrib modules UUID, File Entity, and Entity UUID. It seems there's a conflict between File Entity and Entity UUID that makes the schema object on File Entities not match the database table (file_managed). Just as you say, this patch only fixed the notice and not the warnings. Also, the warnings are triggered when viewing a file entity or flushing cache. I'll keep debugging the other modules but wanted to confirm to you that your assumptions are correct about a malformed entity.
Comment #5
David_Rothstein CreditAttribution: David_Rothstein as a volunteer commentedCommitted to 7.x - thanks!