Answers.Body: <p><a href="https://civicrm.stackexchange.com/users/4159/matthew-wire">Matthew Wire</a> nailed it: the most current version of the Twilio extension for CiviCRM doesn't work with PHP 7.0 -- but luckily for us, <a href="https://github.com/civicrm/org.civicrm.sms.twilio/pull/3" rel="nofollow noreferrer">a huge patch</a> became available through GitHub just one week ago. Since we need PHP 7.0 for other stuff on our site to work, reverting to 5.6 wasn't a viable option.</p>
  
  <p>As soon as the updated Twilio SDK extension was in place, I was able to run those scheduled jobs manually again. This experience also showed me how just one scheduled job that doesn't complete can derail the CRON train altogether. This gives me at least one idea for troubleshooting a persistent CRON headache in which our scheduled jobs run some of the time, yet we haven't yet isolated the problem. It's all connected, isn't it?</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-08-17T04:37:48.543Z
Answers.LastActivityDate: 2017-08-17T04:37:48.543Z
Answers.UserDisplayName: Prónay
Body: <p>Trying to run mass SMS on Twilio which worked great a few months ago, and now it falls apart. Also we hang when trying to send an individual SMS.
  And right after trying to send SMS, the run-all-jobs-manually link on Scheduled Jobs throws an Internal Server (500) error. </p>
  
  <p>Running my CRON command line via SSH gives me this:</p>
  
  <pre><code>Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /[REDACTED]/wp-content/uploads/civicrm/ext/org.civicrm.sms.twilio/Services/Twilio/Resource.php on line 90
  Warning: include(/[REDACTED]/wp-content/uploads/civicrm/ext/org.civicrm.sms.twilio/Services/Twilio/Rest/.php): failed to open stream: No such file or directory in /[REDACTED]/wp-content/uploads/civicrm/ext/org.civicrm.sms.twilio/Services/Twilio.php on line 9
  Warning: include(/[REDACTED]/wp-content/uploads/civicrm/ext/org.civicrm.sms.twilio/Services/Twilio/Rest/.php): failed to open stream: No such file or directory in /[REDACTED]/wp-content/uploads/civicrm/ext/org.civicrm.sms.twilio/Services/Twilio.php on line 9
  Warning: include(): Failed opening '/[REDACTED]/wp-content/uploads/civicrm/ext/org.civicrm.sms.twilio/Services/Twilio/Rest/.php' for inclusion (include_path='/[REDACTED]/wp-content/uploads/civicrm/ext/com.cividesk.email.sparkpost/:/[REDACTED]/wp-content/uploads/civicrm/ext/com.joineryhq.percentagepricesetfield-1.1/:/[REDACTED]/wp-content/uploads/civicrm/ext/net.ourpowerbase.report.advancedfundraising/:/[REDACTED]/wp-content/uploads/civicrm/ext/com.webaccessglobal.module.civimobile/code:/[REDACTED]/wp-content/uploads/civicrm/ext/org.civicrm.sms.twilio/:.:/[REDACTED]/wp-content/plugins/civicrm/civicrm:/[REDACTED]/wp-content/plugins/civicrm/civicrm/packages:/[REDACTED]/wp-content/plugins/civicr in /[REDACTED]/wp-content/uploads/civicrm/ext/org.civicrm.sms.twilio/Services/Twilio.php on line 9
  Fatal error: Uncaught Error: Class 'Services_Twilio_Rest_' not found in /[REDACTED]/wp-content/uploads/civicrm/ext/org.civicrm.sms.twilio/Services/Twilio/Resource.php:47
  Stack trace:
  #0 /[REDACTED]/wp-content/uploads/civicrm/ext/org.civicrm.sms.twilio/Services/Twilio/Rest/Account.php(23): Services_Twilio_Resource-&gt;setupSubresources('applications', 'available_phone...', 'outgoing_caller...', 'calls', 'conferences', 'incoming_phone_...', 'notifications', 'outgoing_caller...', 'recordings', 'sms_messages', 'short_codes', 'transcriptions', 'connect_apps', 'authorized_conn...', 'usage_records', 'usage_triggers', 'queues')
  #1 /[REDACTED]/wp-content/uploads/civicrm/ext/org.civicrm.sms.twilio/Services/Twilio/Resource.php(25): Services_Twilio_Rest_Account-&gt;init(Object(Services_Twilio), '/2010-04-01/Acc...')
  #2 /[REDACTED]/wp-content/uploads/civicrm/ext/org.civicrm.sms.twilio/Services/T in /[REDACTED]/wp-content/uploads/civicrm/ext/org.civicrm.sms.twilio/Services/Twilio/Resource.php on line 47
  </code></pre>
  
  <p>This blew my lunch today &amp; I still haven't wrapped my head around it:</p>
  
  <p><code>PHP Fatal error: Uncaught Error: Class 'Services_Twilio_Rest_' not found in /wp-content/uploads/civicrm/ext/org.civicrm.sms.twilio/Services/Twilio/Resource.php:47</code></p>
  
  <p>Lines 42-51, inclusive:</p>
  
  <p><code>protected function setupSubresources()</code></p>
  
  <pre><code>{
      foreach (func_get_args() as $name) {
          $constantized = ucfirst(self::camelize($name));
          $type = "Services_Twilio_Rest_" . $constantized;
          $this-&gt;subresources[$name] = new $type(
              $this-&gt;client, $this-&gt;uri . "/$constantized"
          );
      }
  }
  </code></pre>
  
  <p>Where should I begin?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-08-15T20:47:42.670Z
Comments.Text: Hi Pronay, what version of PHP are you running?, So looking at this, it would appear to me that its most likely an issue because of L45, So L45 is trying to take something like sms_messages and out put it as SMSMessages. I'm not sure what the` /e` modifier does but that seems to be the issue, So because its failing then $containtized isn't getting set right so it then can't properly construct $type
Comments.UserDisplayName: Seamus Lee
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-08-16T04:33:35.423Z
Comments.Text: PHP version = 7.0.21
Comments.UserDisplayName: Prónay
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-08-16T16:39:07.267Z
Comments.Text: Looks like the current extension doesn't work with PHP7.0 because the included Twilio SDK is too old.  See https://issues.civicrm.org/jira/browse/CRM-21072
Comments.UserDisplayName: Matthew Wire
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-08-16T18:09:38.767Z
Comments.Text: Great! I'm getting the latest Twilio SDK now. Be advised the link on jira is 404. Seems the end parenthesis was absorbed into the href. When I delete the ")" it works though.
Comments.UserDisplayName: Prónay
Tags: <sms><twilio>
Title: Twilio extension stopped working; neither individual nor mass SMS go through
ThreadText: # Twilio extension stopped working; neither individual nor mass SMS go through
  
  (Asked by: username_0 on 2017-08-15)
  
  Trying to run mass SMS on Twilio which worked great a few months ago, and now it falls apart. Also we hang when trying to send an individual SMS.
  And right after trying to send SMS, the run-all-jobs-manually link on Scheduled Jobs throws an Internal Server (500) error.
  
  Running my CRON command line via SSH gives me this:
  
  ```
  Warning: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead in /[REDACTED]/wp-content/uploads/civicrm/ext/org.civicrm.sms.twilio/Services/Twilio/Resource.php on line 90
  Warning: include(/[REDACTED]/wp-content/uploads/civicrm/ext/org.civicrm.sms.twilio/Services/Twilio/Rest/.php): failed to open stream: No such file or directory in /[REDACTED]/wp-content/uploads/civicrm/ext/org.civicrm.sms.twilio/Services/Twilio.php on line 9
  Warning: include(/[REDACTED]/wp-content/uploads/civicrm/ext/org.civicrm.sms.twilio/Services/Twilio/Rest/.php): failed to open stream: No such file or directory in /[REDACTED]/wp-content/uploads/civicrm/ext/org.civicrm.sms.twilio/Services/Twilio.php on line 9
  Warning: include(): Failed opening '/[REDACTED]/wp-content/uploads/civicrm/ext/org.civicrm.sms.twilio/Services/Twilio/Rest/.php' for inclusion (include_path='/[REDACTED]/wp-content/uploads/civicrm/ext/com.cividesk.email.sparkpost/:/[REDACTED]/wp-content/uploads/civicrm/ext/com.joineryhq.percentagepricesetfield-1.1/:/[REDACTED]/wp-content/uploads/civicrm/ext/net.ourpowerbase.report.advancedfundraising/:/[REDACTED]/wp-content/uploads/civicrm/ext/com.webaccessglobal.module.civimobile/code:/[REDACTED]/wp-content/uploads/civicrm/ext/org.civicrm.sms.twilio/:.:/[REDACTED]/wp-content/plugins/civicrm/civicrm:/[REDACTED]/wp-content/plugins/civicrm/civicrm/packages:/[REDACTED]/wp-content/plugins/civicr in /[REDACTED]/wp-content/uploads/civicrm/ext/org.civicrm.sms.twilio/Services/Twilio.php on line 9
  Fatal error: Uncaught Error: Class 'Services_Twilio_Rest_' not found in /[REDACTED]/wp-content/uploads/civicrm/ext/org.civicrm.sms.twilio/Services/Twilio/Resource.php:47
  Stack trace:
  #0 /[REDACTED]/wp-content/uploads/civicrm/ext/org.civicrm.sms.twilio/Services/Twilio/Rest/Account.php(23): Services_Twilio_Resource->setupSubresources('applications', 'available_phone...', 'outgoing_caller...', 'calls', 'conferences', 'incoming_phone_...', 'notifications', 'outgoing_caller...', 'recordings', 'sms_messages', 'short_codes', 'transcriptions', 'connect_apps', 'authorized_conn...', 'usage_records', 'usage_triggers', 'queues')
  #1 /[REDACTED]/wp-content/uploads/civicrm/ext/org.civicrm.sms.twilio/Services/Twilio/Resource.php(25): Services_Twilio_Rest_Account->init(Object(Services_Twilio), '/2010-04-01/Acc...')
  #2 /[REDACTED]/wp-content/uploads/civicrm/ext/org.civicrm.sms.twilio/Services/T in /[REDACTED]/wp-content/uploads/civicrm/ext/org.civicrm.sms.twilio/Services/Twilio/Resource.php on line 47
  
  ```
  
  This blew my lunch today & I still haven't wrapped my head around it:
  
  `PHP Fatal error: Uncaught Error: Class 'Services_Twilio_Rest_' not found in /wp-content/uploads/civicrm/ext/org.civicrm.sms.twilio/Services/Twilio/Resource.php:47`
  
  Lines 42-51, inclusive:
  
  `protected function setupSubresources()`
  
  ```
  {
      foreach (func_get_args() as $name) {
          $constantized = ucfirst(self::camelize($name));
          $type = "Services_Twilio_Rest_" . $constantized;
          $this->subresources[$name] = new $type(
              $this->client, $this->uri . "/$constantized"
          );
      }
  }
  
  ```
  
  Where should I begin?
  
  **Tags:** sms, twilio
  
  > **Comments:**
  > **username_1**: Hi Pronay, what version of PHP are you running?, So looking at this, it would appear to me that its most likely an issue because of L45, So L45 is trying to take something like sms_messages and out put it as SMSMessages. I'm not sure what the` /e` modifier does but that seems to be the issue, So because its failing then $containtized isn't getting set right so it then can't properly construct $type  
  > **username_0**: PHP version = 7.0.21  
  > **username_2**: Looks like the current extension doesn't work with PHP7.0 because the included Twilio SDK is too old.  See https://issues.civicrm.org/jira/browse/CRM-21072  
  > **username_0**: Great! I'm getting the latest Twilio SDK now. Be advised the link on jira is 404. Seems the end parenthesis was absorbed into the href. When I delete the ")" it works though.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2017-08-17. Score: 1
  
  [username_2](https://civicrm.stackexchange.com/users/4159/username_2) nailed it: the most current version of the Twilio extension for CiviCRM doesn't work with PHP 7.0 -- but luckily for us, [a huge patch](https://github.com/civicrm/org.civicrm.sms.twilio/pull/3) became available through GitHub just one week ago. Since we need PHP 7.0 for other stuff on our site to work, reverting to 5.6 wasn't a viable option.
  
  As soon as the updated Twilio SDK extension was in place, I was able to run those scheduled jobs manually again. This experience also showed me how just one scheduled job that doesn't complete can derail the CRON train altogether. This gives me at least one idea for troubleshooting a persistent CRON headache in which our scheduled jobs run some of the time, yet we haven't yet isolated the problem. It's all connected, isn't it?
  
  
  ---
  
  