Hi,
At first I thought it was just my setup but now I've received errors during drush-based installation of message module on a relatively clean installation (Drupal 7.26 on PostgreSQL database):
The following extensions will be enabled: message
Do you really want to continue? (y/n): y
WD php: FieldException: Attempt to create a field with invalid [error]
characters. Only lowercase alphanumeric characters and underscores
are allowed, and only lowercase letters and underscore are allowed as
the first character in field_create_field() (line 67 of
/var/www/drupal-testing/modules/field/field.crud.inc).
Cannot modify header information - headers already sent by (output [warning]
started at /usr/share/php/drush/includes/output.inc:38)
bootstrap.inc:1217
FieldException: Attempt to create a field with invalid characters. Only lowercase alphanumeric characters and underscores are allowed, and only lowercase letters and underscore are allowed as the first character in field_create_field() (line 67 of /var/www/drupal-testing/modules/field/field.crud.inc).
Drush command terminated abnormally due to an unrecoverable error.
As expected from the error, the field_data_message_text table was not created correctly in message_install() within the .install file. Since the message_schema() tables are setup first, the tables message, message_type and message_type_category are correctly installed.
After disabling and uninstalling the module I ran update.php (drush updb and cleared cache separately again with drush cc all) as well as cron (drush cron) and the installation proceeded normally.
While it's hard to test without setting up a clean Drupal installation, this bug may only occur upon initial installation attempts (or even Drush-only based installations). With the limited error log info I don't know what the field with "invalid characters" looks like to that function in the first and third error (the constant MESSAGE_FIELD_MESSAGE_TEXT should be defined as "message_text" by the .module file which is loaded before the .install file).
Alternately, I don't know if Drupal's field info cache is being rebuilt after message_schema() does its thing in message_install(). Perhaps _field_info_collate_types(TRUE) should be run before field_create_field($field) in message_install()? (Or field_info_cache_clear()?)
However, the absence of this bug being reported for such a long time (or my inability to find it) may indicate a problem specific to my server setup.
Cheers
Comments
Comment #1
betz CreditAttribution: betz commentedI can confirm this issue.
Comment #2
betz CreditAttribution: betz commentedcmonnow, by any chance using the cer module?
Comment #3
cmonnow CreditAttribution: cmonnow commentedAfter experiencing issues repeatedly with drush installations I've received a response from Drupal member pobster (https://www.drupal.org/node/2311711) that seems to explain why. Apparently .module files are not always included before being called by a hook_install within a .install file, and drush may not load all required files into memory either (apparently clearing drush's cache can fix things -
drush cc drush
).I can also confirm I don't use the cer module.
Cheers
Comment #4
StevenWill CreditAttribution: StevenWill commentedHad this happen to me. Uninstalled message, ran drush cc drush and re-installed message.
Comment #5
DamienMcKennaI've opened an issue for the Drush project to see what its maintainers think: https://github.com/drush-ops/drush/issues/1101
Comment #6
youkho CreditAttribution: youkho commentedEncountered the same issue even without installing from drush.
Comment #7
bluegeek9 CreditAttribution: bluegeek9 as a volunteer commented