mb_strlen($str, 'UTF-8') returns wrong length for unicode payload, unicode messaged does not send. Fixed to strlen($str)
Corrected length for unicode chars
@hairyhum Please add a unit test case.
Any ETA on this please? I have implemented the fix locally but it'd be nice if it made it's way into the original repo.
Without unit test I can't see why this should be merged.
@maciekish If you can write the unit test you may send a PR with the code of @hairyhum
@Maks3w I think i could but Im not sure about the philosophy behind the test. What should it test for? Input a unicode message and check if the calculated length is correct?
Exactly. One test for an errored scenario and another one for a sucessful scenario.
But the errored scenario only occurs in the old code, not in the new code. Don't really understand how to do that in the test.
Fix string length issue for unicode payloads. Ref zendframework#8 (comment)
Proper length of binary token data
@maciekish The idea with a unit test is to do the following:
In your case, you've indicated that given a certain value, the code currently does not perform as expected -- so you would test using that value, and provide your expectation in the form of an assertion.
Personally, I have my doubts about whether or not this is correct. If UTF-8 is not provided, your patch would incorrectly calculate the length (essentially doubling it). This is why we want tests.
I don't know how to write the unit test you want but I can confirm that this patch correct the error of sending UTF-8 push message (like accents in french).
This looks like it was previously fixed.