0

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?

  • 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 – Seamus Lee Aug 15 '17 at 20:47
  • PHP version = 7.0.21 – Prónay Aug 16 '17 at 4:33
  • Looks like the current extension doesn't work with PHP7.0 because the included Twilio SDK is too old. See issues.civicrm.org/jira/browse/CRM-21072 – Matthew Wire Aug 16 '17 at 16:39
  • 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. – Prónay Aug 16 '17 at 18:09
1

Matthew Wire 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 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?

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.