alexandr-mironov / php-smpp

PHP SMPP (v 3.4) client
47 stars 22 forks source link

Fix message length calculation with UCS-2 encoding #1

Closed bianchim closed 4 years ago

bianchim commented 4 years ago

When using the library, I came across a small bug preventing some SMS from being sent.

Only messages between 70 and 140 characters would fail when sent with the UCS-2 encoding. If the message is short or long enough, it does not fall in this particular case.

By digging a bit I saw that message length is calculated before encoding conversion, creating a mismatch between the actual length of the string and the one used for comparison.

Thus adding a strlen after re-encoding the message fixes it.

fdelapena commented 4 years ago

https://github.com/alexandr-mironov/php-smpp/commit/b1dd3130af974e0a310b42d3df46e17f6e06cd37 fixed it already.

alexandr-mironov commented 4 years ago

Hello, sorry, i didn't saw this pull request, and already fix that issue (using mb_string)