2

When I try to run drush right now I get this error:

-bash-4.1$ drush pm-list
Drush command terminated abnormally due to an unrecoverable error.   [error]
Error: syntax error, unexpected T_FUNCTION in
<site location>/sites/all/modules/webform/webform.module,
line 4654

Here is the function where the error occurs:

/**
 * Get a list of all available component definitions.
 */
function webform_components($include_disabled = FALSE, $reset = FALSE) {
  static $components, $enabled;

  if (!isset($components) || $reset) {
    $components = array();
    $disabled = array_flip(webform_variable_get('webform_disabled_components'));
    foreach (module_implements('webform_component_info') as $module) {
      $module_components = module_invoke($module, 'webform_component_info');
      foreach ($module_components as $type => $info) {
        $module_components[$type]['module'] = $module;
        $module_components[$type]['enabled'] = !array_key_exists($type, $disabled);
      }
      $components += $module_components;
    }
    drupal_alter('webform_component_info', $components);
    uasort($components, function($a, $b) {
      return strnatcasecmp($a['label'], $b['label']);
    });
    $enabled = array_diff_key($components, $disabled);
  }

  return $include_disabled ? $components : $enabled;
}

Line 4654 is the one that starts with "uasort" (near the bottom). I'm using

  • PHP 5.6.15
  • Drupal 7.41
  • Webform 7.x-4.12

Drush was working for the whole project (up till now) and webform was installed near the start of the project.

2
  • 1
    Sounds like you're using a different php version for CLI - that syntax is valid as of >= php5.3. What does php -v show you from the command line?
    – Clive
    Commented Jan 15, 2016 at 8:50
  • Oh you're right, 5.2.17. Didn't know it was different things. Thanks, this helps narrow down the problem.
    – Matt Coady
    Commented Jan 15, 2016 at 10:05

1 Answer 1

1

It's seems to be a problem with the anonymous function. I read some post that talk about a problem with eAccelerator and the PHP version. The recomendations are:

  • disabling eAccelerator and opcode caching
  • replacing eAccelerator with Zend's opcache
  • reverting to PHP 5.3

You can read more at:

1
  • 1
    Bluehost only has options for php 5.4 & 5.6. I tried both without luck but I've been on 5.6 since the project started about 2 months ago (this is a recent issue). Don't have eAccelerator or opcode caching installed. Tried this solution as well but no luck drupal.org/node/2467239#comment-10238491
    – Matt Coady
    Commented Jan 15, 2016 at 6:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.