From e11c1ff52fff3d5c094501fc26d8d0a636ff74e1 Mon Sep 17 00:00:00 2001 From: Kevin Israel Date: Sat, 31 Jan 2015 03:15:36 -0500 Subject: [PATCH] codepointToUtf8(): Throw exception rather than calling die() Change-Id: I0f2c05be95d34e069a3e9965f581d2adfc0a1b9d --- includes/libs/normal/UtfNormalUtil.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/libs/normal/UtfNormalUtil.php b/includes/libs/normal/UtfNormalUtil.php index 6c925dfafe..ae88e73e90 100644 --- a/includes/libs/normal/UtfNormalUtil.php +++ b/includes/libs/normal/UtfNormalUtil.php @@ -27,10 +27,10 @@ /** * Return UTF-8 sequence for a given Unicode code point. - * May die if fed out of range data. * * @param $codepoint Integer: * @return String + * @throws InvalidArgumentException if fed out of range data. * @public */ function codepointToUtf8( $codepoint ) { @@ -56,8 +56,7 @@ function codepointToUtf8( $codepoint ) { chr( $codepoint & 0x3f | 0x80 ); } - echo "Asked for code outside of range ($codepoint)\n"; - die( -1 ); + throw new InvalidArgumentException( "Asked for code outside of range ($codepoint)" ); } /** @@ -67,6 +66,7 @@ function codepointToUtf8( $codepoint ) { * * @param $sequence String * @return String + * @throws InvalidArgumentException if fed out of range data. * @private */ function hexSequenceToUtf8( $sequence ) { -- 2.20.1