histogram: Make histograms crash less
[ninja.git] / application / helpers / i18n.php
blob74ddb10b773854658c205b2a1a497700f823ab78
1 <?php
2 /**
3 * Functionality used for internationalization related functionality
4 */
6 class i18n_Core {
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));