Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
The results of sms_send() are inconsistent and not well document. In some places boolean (TRUE|FALSE) is expected, but in others an array containing more definitive values are expected.
Proposed resolution
1. Clearly define the return values from sms_send()
2. Document these in the codebase and on drupal.org
3. Write a patch to implement
4. Review patch
5. Commit
Remaining tasks
All
User interface changes
None
API changes
None
Data model changes
None
Comment | File | Size | Author |
---|---|---|---|
#6 | clarify_the_api_for-2542866-6.patch | 5.95 KB | almaudoh |
#6 | interdiff.txt | 1.69 KB | almaudoh |
#3 | clarify_the_api_for-2542866-3.patch | 5.79 KB | almaudoh |
Comments
Comment #1
almaudoh CreditAttribution: almaudoh commentedComment #2
almaudoh CreditAttribution: almaudoh commentedAfter #2509566: Convert sms_send() into a service, the simple solution to this should be to return
SmsMessageResultInterface
fromSmsProviderInterface::send()
, then to maintain BC,sms_send()
still returnsTRUE
or throws an exception to match its existing behavior.This way, old code doesn't break, while new code that needs detailed information on the message result calls the
SmsProviderInterface::send()
method directly (which should more often be the case) and interrogates theSmsMessageResultInterface
return value.Comment #3
almaudoh CreditAttribution: almaudoh commentedSo, here's a patch following #2. Let's see what breaks.
Comment #6
almaudoh CreditAttribution: almaudoh commentedMinor corrections to fix the test fail.
Comment #8
almaudoh CreditAttribution: almaudoh commentedEasy fix. Committed and pushed to 8.x-1.x
Comment #10
almaudoh CreditAttribution: almaudoh commentedUpdated the LogGateway to return a value that conforms with the new interface expectations.