ApnsPHP icon indicating copy to clipboard operation
ApnsPHP copied to clipboard

Changed strlen for binary data to take into account mbstring.func_overload

Open pmxmatt opened this issue 9 years ago • 3 comments

The function strlen behaves differently when mbstring.func_overload is enabled for the strlen function.

This was causing the message sending to fail I've updated the code based on the comment from a user on the official documentation http://php.net/manual/en/function.strlen.php#54906 .

pmxmatt avatar Oct 28 '14 08:10 pmxmatt

Hi, thanks but… latin1?

duccio avatar Oct 28 '14 09:10 duccio

Using latin1 forces it into single-byte mode.

I've tested this with both mbstring.func_overload on and off in environment and it is now counting correctly.

pmxmatt avatar Oct 28 '14 10:10 pmxmatt

What's the point of checking mbstring.func_overload if mb_strlen($aMessage['BINARY_NOTIFICATION'],'latin1'); does always the right job? It could be used in place of strlen always I guess.

lucabrunox avatar May 08 '15 13:05 lucabrunox