]> granicus.if.org Git - php/commit
Return false on invalid codepoint in mb_chr()
authorNikita Popov <nikita.ppv@gmail.com>
Thu, 3 Aug 2017 20:32:31 +0000 (22:32 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Thu, 3 Aug 2017 20:36:42 +0000 (22:36 +0200)
commite53162a32b011ef22c3e0210e7af334d968f227c
treedc3ba9d40d9fbcb8322c4876d49498b8262e2c5d
parent41e9ba6333ab58c9fe3eb8bd413cc3e0eca87be1
Return false on invalid codepoint in mb_chr()

Instead of returning the encoding of the current substitution
character. This allows a robust check for the failure case. The
substitution character (especially the default of "?") is also
a valid output of mb_chr() for a valid input (for "?" that would be
0x3f), so it's a bad choice for an error value.
ext/mbstring/mbstring.c
ext/mbstring/tests/mb_chr.phpt