Answers.Body: <p>These two are <em>warnings</em>, not fatal errors. It's possible that they are harmless, and likely that they indicate that the extension is not yet configured.</p>
  
  <p>Both report that the <a href="http://php.net/manual/en/function.glob.php" rel="nofollow"><code>glob()</code></a> for files returned something other than an array - which suggests that glob returned <code>FALSE</code>, meaning either the path searched didn't exist or the web user's permissions didn't allow CiviCRM to scan for files there.</p>
  
  <p>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 <code>glob()</code> is before treating it as an array, and if the return value <em>isn't</em> an array to produce a helpful error message.</p>
  
  <p>If that sounds too complex, you could open an issue on the Github project for Twilio, and refer the authors to this extension.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-10T08:26:01.947Z
Answers.Text: Thanks for responding - that gives me somewhere to start at least! I will give the three suggestions a try in the first instance :))
Answers.UserDisplayName: Caroline B
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-10T08:40:12.193Z
Answers.Text: 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?
Answers.UserDisplayName: Chris Burgess
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-10T08:47:49.000Z
Answers.Text: Double check paths in `civicrm.settings.php`, directory settings and (if applicable) extension settings.
Answers.UserDisplayName: Chris Burgess
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-09T21:26:12.093Z
Answers.LastActivityDate: 2015-09-09T21:26:12.093Z
Answers.UserDisplayName: Chris Burgess
Body: <p>I have installed the twilio extension (<a href="https://civicrm.org/extensions/twilio-sms-provider" rel="nofollow noreferrer">extensions</a>, <a href="https://github.com/civicrm/org.civicrm.sms.twilio/blob/master/twilio.civix.php" rel="nofollow noreferrer">github</a>) on a new civicrm site.</p>
  <p>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.</p>
  <blockquote>
  <p>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).</p>
  <p>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).</p>
  </blockquote>
  <p>I have gone and looked the <a href="https://github.com/civicrm/org.civicrm.sms.twilio/blob/master/twilio.civix.php" rel="nofollow noreferrer">twilio.civix.php</a>  file</p>
  <p>The first instance:</p>
  <pre><code>function _twilio_civix_civicrm_xmlMenu(&amp;$files) {
    foreach (glob(__DIR__ . '/xml/Menu/*.xml') as $file) {  // this is line 34
      $files[] = $file;
    }
  }
  </code></pre>
  <p>And the second instance:</p>
  <pre><code>function _twilio_civix_find_files($dir, $pattern) {
    $todos = array($dir);
    $result = array();
    while (!empty($todos)) {
      $subdir = array_shift($todos);
      foreach (glob(&quot;$subdir/$pattern&quot;) 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;
  }
  </code></pre>
  <p>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.</p>
  <p>Any thoughts about where to go with this woudl be gratefully received!</p>
  <p>Thanks
  Caroline</p>
  <p>Site is drupal 7/CiviCRM 4.6.8.</p>
  
Tags: <civisms>
Title: Twilio extension installation problem - php query (I think!)
ThreadText: # Twilio extension installation problem - php query (I think!)
  
  (Asked by: username_0 on 2015-09-09)
  
  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.
  
  **Tags:** civisms
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-09-09. Score: 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()`](http://php.net/manual/en/function.glob.php) 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.
  
  > **Comments:**
  > **username_0**: Thanks for responding - that gives me somewhere to start at least! I will give the three suggestions a try in the first instance :))  
  > **username_1**: 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?  
  > **username_1**: Double check paths in `civicrm.settings.php`, directory settings and (if applicable) extension settings.  
  
  ---
  
  