fix: Fix constructor to properly retrieve capabilities values#813
Open
ibnsultan wants to merge 3 commits intotwilio:mainfrom
Open
fix: Fix constructor to properly retrieve capabilities values#813ibnsultan wants to merge 3 commits intotwilio:mainfrom
ibnsultan wants to merge 3 commits intotwilio:mainfrom
Conversation
Updated the `PhoneNumberCapabilities` constructor to correctly retrieve the values for `mms`, `sms`, `voice`, and `fax`. The case-sensitive keys for `MMS` and `SMS` were changed to uppercase, and default values are now `false` instead of strings. This resolves the issue where incorrect values were being assigned to the capabilities properties.
|
I have this issue too. Have you found an workaround until this is solved? Update: I have implemented this workaround: |
Author
|
@Shakerrry Not really other than the edit and locking the file from being overwritted from the package changes |
|
Can we get some attention to this and get it released? |
|
for those who get here, until @twilio-dx takes some time to fix their own error, this might help, a composer post-autoload-dump: "scripts": {
"post-autoload-dump": [
"sed -i.bak \"s/\\$capabilities, 'mms'/\\$capabilities, 'MMS'/g\" vendor/twilio/sdk/src/Twilio/Base/PhoneNumberCapabilities.php",
"sed -i.bak \"s/\\$capabilities, 'sms'/\\$capabilities, 'SMS'/g\" vendor/twilio/sdk/src/Twilio/Base/PhoneNumberCapabilities.php",
"sed -i.bak \"s/\\\"false\\\"/false/g\" vendor/twilio/sdk/src/Twilio/Base/PhoneNumberCapabilities.php"
]
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What kind of change does this PR introduce?
Error Description
The original constructor incorrectly retrieved the
mmsandsmsvalues due to case sensitivity in the array keys ('mms'and'sms'instead of'MMS'and'SMS'). This resulted in default values being returned as"false"(a string) rather thanfalse(a boolean), causing:Unexpected behavior in JSON serialization and comparisons.
Direct retrieval of class items (e.g.,
getSMS,getMMS, etc.) always returnedtruebecause the methods were enforced to return:bool. Since the allocated value was a string, it was evaluated astrue.Also the capabilities response does not include the
faxstatus causing to always default to falseFixed Issues Description
Updated the
PhoneNumberCapabilitiesconstructor to correctly retrieve the values formms,sms,voice, andfax. The case-sensitive keys forMMSandSMSwere changed to uppercase, and default values are nowfalseinstead of strings. This resolves the issue where incorrect values were being assigned to the capabilities properties.Unfixed Issue Description
The
faxvalue will still default tofalsebecause the capabilities response, whether retrieved through the SDK or the REST API, does not include the fax status. Therefore, even though the constructor attempts to retrievefax, it will always be set tofalse.Does this PR introduce a breaking change? (check one)
Related Issue
#783
Checklist
If you have questions, please file a support ticket, or create a GitHub Issue in this repository.