osTicket/osTicket-1.8 — pull request #811 by greezybacon (2014-04-28 19:00:05+00:00)
Title: storage: Avoid using `strlen` to count bytes

For PHP installations that have `mbstring.func_overload` enabled (set to a value including `2`), the `strlen` function will be overloaded to use the `mb_strlen` equivalent. Problematically, the internal encoding of `UTF-8` will be applied to all file content, which will count UTF-8 characters rather than bytes. This will cause the data to be saved correctly; however, the `size` recorded in the %file table will be recorded incorrectly.

This patch allows the backend to report the size of the contents saved with the request and provides a failsafe mechanism which will use the mbstring equivalent if available, and the mbstring version is coded to use the `8bit` as the encoding which will prevent reading characters.

References:
https://github.com/osTicket/osTicket-1.8/issues/552