2

I have installed the twilio extension (extensions, github) on a new civicrm site.

I was unable to install using the in civicrm method so uploaded via FTP and then refreshed the installed extension page. Pressed install and got the following error message.

Warning: Invalid argument supplied for foreach() in _twilio_civix_civicrm_xmlMenu() (line 34 of /var/www/vhosts/XXXX.net/httpdocs/sites/default/files/civicrm/custom_ext/org.civicrm.sms.twilio-master/twilio.civix.php).

Warning: Invalid argument supplied for foreach() in _twilio_civix_find_files() (line 118 of /var/www/vhosts/XXXXX.net/httpdocs/sites/default/files/civicrm/custom_ext/org.civicrm.sms.twilio-master/twilio.civix.php).

I have gone and looked the twilio.civix.php file

The first instance:

function _twilio_civix_civicrm_xmlMenu(&$files) {
  foreach (glob(__DIR__ . '/xml/Menu/*.xml') as $file) {  // this is line 34
    $files[] = $file;
  }
}

And the second instance:

function _twilio_civix_find_files($dir, $pattern) {
  $todos = array($dir);
  $result = array();
  while (!empty($todos)) {
    $subdir = array_shift($todos);
    foreach (glob("$subdir/$pattern") as $match) { // this is line 118
      if (!is_dir($match)) {
        $result[] = $match;
      }
    }
    if ($dh = opendir($subdir)) {
      while (FALSE !== ($entry = readdir($dh))) {
        $path = $subdir . DIRECTORY_SEPARATOR . $entry;
        if ($entry == '.' || $entry == '..') {
        } elseif (is_dir($path)) {
          $todos[] = $path;
        }
      }
      closedir($dh);
    }
  }
  return $result;
}

But I literally have no clue what is wrong as I am not that familiar with PHP. I have tried to install both the new version of twilio and the previous version but the error message is the same. I have successfully used the twilio extension on another site.

Any thoughts about where to go with this woudl be gratefully received!

Thanks Caroline

Site is drupal 7/CiviCRM 4.6.8.

2

These two are warnings, not fatal errors. It's possible that they are harmless, and likely that they indicate that the extension is not yet configured.

Both report that the glob() for files returned something other than an array - which suggests that glob returned FALSE, meaning either the path searched didn't exist or the web user's permissions didn't allow CiviCRM to scan for files there.

First off, I'd make sure the extension is configured properly. If that didn't solve the issue, I'd add some debug code to see what the return value of glob() is before treating it as an array, and if the return value isn't an array to produce a helpful error message.

If that sounds too complex, you could open an issue on the Github project for Twilio, and refer the authors to this extension.

  • Thanks for responding - that gives me somewhere to start at least! I will give the three suggestions a try in the first instance :)) – Caroline B Sep 10 '15 at 8:26
  • Yeah, check what the path/glob pattern going in is - it may reveal that the path on disk is being calculated with the wrong location or something? – Chris Burgess Sep 10 '15 at 8:40
  • 1
    Double check paths in civicrm.settings.php, directory settings and (if applicable) extension settings. – Chris Burgess Sep 10 '15 at 8:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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