Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 29460be

Browse files
committed
merged branch drm/master (PR #1615)
Commits ------- 9714cfc Fixes fatal error when intl module is not installed. Discussion ---------- Session instantiation breaks with Fatal error if intl module is not installed. A check for class_exists in setPhpDefaultLocale() fixes this, though I got the feeling it should be resolved with a proxy or subscriber object; setPhpDefaultLocale feels like a hack now. --------------------------------------------------------------------------- by stealth35 at 2011/07/10 06:32:43 -0700 Locale::setDefault don't throw any exception Maybe just : ```php if (class_exists('Locale', false)) { return \Locale::setDefault($this->locale); } else { return false; } ```
2 parents 5e2729c + 9714cfc commit 29460be

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/Symfony/Component/HttpFoundation/Session.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -355,10 +355,14 @@ public function unserialize($serialized)
355355

356356
private function setPhpDefaultLocale($locale)
357357
{
358+
// if either the class Locale doesn't exist, or an exception is thrown when
359+
// setting the default locale, the intl module is not installed, and
360+
// the call can be ignored:
358361
try {
359-
\Locale::setDefault($this->locale);
362+
if (class_exists('Locale', false)) {
363+
\Locale::setDefault($locale);
364+
}
360365
} catch (\Exception $e) {
361-
// means that intl is not installed.
362366
}
363367
}
364368
}

0 commit comments

Comments
 (0)