From 1bcba60f80c1c2d11ae66cf41977d61d2d417cdc Mon Sep 17 00:00:00 2001 From: MatmaRex Date: Fri, 18 Jan 2013 22:36:32 +0100 Subject: [PATCH] (bug 43801) add a getter for ICU version to ICUCollation It will be necessary to be able to use correct version of Unicode data files. The constant INTL_ICU_VERSION this getter returns isn't really documented. It is available since PHP 5.3.7 (see PHP bug 54561), the getter will fail gracefully on older PHPs. It should be possible to determine the ICU version on these by grepping the output of phpinfo(), but I don't think such a minor improvement is worth such a huge hack. Change-Id: Iee4b8380406ae71c980dfdd7b9fdd0b58ecb9cd0 --- includes/Collation.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/includes/Collation.php b/includes/Collation.php index 3cc7902855..63cfbe18fb 100644 --- a/includes/Collation.php +++ b/includes/Collation.php @@ -374,5 +374,21 @@ class IcuCollation extends Collation { } return false; } + + /** + * Return the version of ICU library used by PHP's intl extension, + * or false when the extension is not installed of the version + * can't be determined. + * + * The constant INTL_ICU_VERSION this function refers to isn't really + * documented. It is available since PHP 5.3.7 (see PHP bug 54561). + * This function will return false on older PHPs. + * + * @since 1.21 + * @return string|false + */ + static function getICUVersion() { + return defined( 'INTL_ICU_VERSION' ) ? INTL_ICU_VERSION : false; + } } -- 2.20.1