Merge branch 'maint/7.0'
[ninja.git] / application / helpers / i18n.php
blob6f565688557e2bb074daf21f020b500e6f0fd964
1 <?php
2 /**
3 * Functionality used for internationalization related functionality
4 */
6 class i18n {
7 /**
8 * A wrapper around PHP's unserialize that tries to cope when the database
9 * encoding has changed.
11 public static function unserialize($string) {
12 $ret = @unserialize($string);
13 if ($ret !== false)
14 return $ret;
17 // When upgrading from <5.3.2 to >=5.3.2, this is needed
18 $ret = @unserialize(@utf8_encode($string));
19 if ($ret !== false)
20 return $ret;
22 // This shouldn't ever happen, but why not try? If we get this far,
23 // all the reasonable methods have already failed.
24 return @unserialize(@utf8_decode($string));