When enabling the module on a Drupal 7.54 site, I get a PHP parse error on Line 79:
$ drush @sitename en addtocalendar
The following extensions will be enabled: addtocalendar
Do you really want to continue? (y/n): y
PHP Parse error: syntax error, unexpected '[' in /data/virtual/common/drupal/sites/all/modules/addtocalendar/addtocalendar.module on line 79
Drush command terminated abnormally due to an unrecoverable error. [error]
Error: syntax error, unexpected '[' in /data/virtual/common/drupal/sites/all/modules/addtocalendar/addtocalendar.module, line 79
I inspected the (rather innocuous) line in question, which is here with some context:
...
71: $info = array(
72: 'atc_title' => t('Title'),
73: 'atc_description' => t('Description'),
74: 'atc_location' => t('Location'),
75: 'atc_organizer' => t('Organizer'),
76: 'atc_organizer_email' => t('Organizer email'),
77: 'atc_date_end' => t('End Date'),
78: );
79: $field_options = [];
80: foreach($field_list as $id => $field_i) {
81: $field_options[$id] = $field_i['label'];
82: }
...
Seems like a valid line to me. I tried changing it to $field_options = array();, but no dice.
Any ideas why it's crashing on this line?
Comments
Comment #2
gg24 commentedHi @mjchadwick,
This issue is maybe because of the PHP version used. I think '[]' works for PHP version > 5.6.
Can you please check it once and let us know?
Thanks!
Comment #3
gg24 commentedHi @mjchadwick,
We have fixed this issue in 'https://www.drupal.org/node/2876640'.
Hence marking this as fixed.
Thanks!