]> granicus.if.org Git - php/commitdiff
Implemented FR #54561 (Expose ICU Version & ICU Data Version info).
authorIlia Alshanetsky <iliaa@php.net>
Wed, 1 Jun 2011 16:26:21 +0000 (16:26 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Wed, 1 Jun 2011 16:26:21 +0000 (16:26 +0000)
ext/intl/php_intl.c
ext/intl/tests/intl_icu_version_constant.phpt [new file with mode: 0644]

index ab5640486ddfc64e88b6ae0f44b3cd1f11f234b8..fa328cc5afd31640552e81f21ee8cde838f7e2c9 100755 (executable)
@@ -590,6 +590,10 @@ PHP_MINIT_FUNCTION( intl )
        REGISTER_INI_ENTRIES();
 
        REGISTER_LONG_CONSTANT("INTL_MAX_LOCALE_LEN", INTL_MAX_LOCALE_LEN, CONST_CS);
+       REGISTER_STRING_CONSTANT("INTL_ICU_VERSION", U_ICU_VERSION, CONST_PERSISTENT | CONST_CS);
+#ifdef U_ICU_DATA_VERSION
+       REGISTER_STRING_CONSTANT("INTL_ICU_DATA_VERSION", U_ICU_DATA_VERSION, CONST_PERSISTENT | CONST_CS);
+#endif 
 
        /* Register 'Collator' PHP class */
        collator_register_Collator_class( TSRMLS_C );
diff --git a/ext/intl/tests/intl_icu_version_constant.phpt b/ext/intl/tests/intl_icu_version_constant.phpt
new file mode 100644 (file)
index 0000000..1316069
--- /dev/null
@@ -0,0 +1,10 @@
+--TEST--
+INTL_ICU_VERSION constant
+--SKIPIF--
+<?php if( !extension_loaded( 'intl' ) ) print 'skip'; ?>
+--FILE--
+<?php
+var_dump(defined("INTL_ICU_VERSION"));
+?>
+--EXPECT--
+bool(true)