Implement phutil_is_utf8_with_only_bmp_characters() without segfaulting

Summary: See comments. The regexp based implementation segfaults unpreventably on small inputs. Do it nice and slow in PHP instead.

Test Plan: Ran unit tests.

Reviewers: btrahan, arice

Reviewed By: arice

CC: chad, arice, aran

Differential Revision: https://secure.phabricator.com/D8312