Exception
InvalidArgumentException
Locale `q` could not be parsed.
Source
Stack Trace
-
[exception]
/var/www/libraries/lithium/g11n/Locale.php: 116
111 $regex .= '(?:[_-](?P<script>[a-z]{4}))?'; 112 $regex .= '(?:[_-](?P<territory>[a-z]{2}))?'; 113 $regex .= '(?:[_-](?P<variant>[a-z]{5,}))?'; 114 115 if (!preg_match("/^{$regex}$/i", $locale, $matches)) { 116 throw new InvalidArgumentException("Locale `{$locale}` could not be parsed."); 117 } 118 return array_filter(array_intersect_key($matches, static::$_tags)); 119 } 120 121 /** -
lithium\g11n\Locale::canonicalize()
/var/www/libraries/lithium/g11n/Locale.php: 128
123 * 124 * @param string $locale A locale in an arbitrary form (i.e. `'ZH-HANS-HK_REVISED'`). 125 * @return string A locale in it's canonical form (i.e. `'zh_Hans_HK_REVISED'`). 126 */ 127 public static function canonicalize($locale) { 128 $tags = static::decompose($locale); 129 130 foreach ($tags as $name => &$tag) { 131 foreach ((array) static::$_tags[$name]['formatter'] as $formatter) { 132 $tag = $formatter($tag); 133 } -
lithium\g11n\Locale::_preferredAction()
/var/www/libraries/lithium/g11n/Locale.php: 246
241 $regex = '(?P<locale>[\w\-]+)+(?:;q=(?P<quality>[0-9]+\.[0-9]+))?'; 242 $result = array(); 243 244 foreach (explode(',', $request->env('HTTP_ACCEPT_LANGUAGE')) as $part) { 245 if (preg_match("/{$regex}/", $part, $matches)) { 246 $locale = static::canonicalize($matches['locale']); 247 $quality = isset($matches['quality']) ? $matches['quality'] : 1; 248 $result[$locale] = $quality; 249 } 250 } 251 arsort($result); -
lithium\g11n\Locale::preferred()
/var/www/libraries/lithium/g11n/Locale.php: 216
211 */ 212 public static function preferred($request, $available = null) { 213 if (is_array($request)) { 214 $result = $request; 215 } elseif ($request instanceof \lithium\action\Request) { 216 $result = static::_preferredAction($request); 217 } elseif ($request instanceof \lithium\console\Request) { 218 $result = static::_preferredConsole($request); 219 } else { 220 return null; 221 } -
/var/www/app/config/bootstrap/g11n.php::{closure} @ 127
/var/www/app/config/bootstrap/g11n.php: 129
124 * the locale of the request or if that is not available retrieving a locale preferred 125 * by the client. 126 */ 127$setLocale = function($self, $params, $chain) { 128 if (!$params['request']->locale()) { 129 $params['request']->locale(Locale::preferred($params['request'])); 130 } 131 Environment::set(true, array('locale' => $params['request']->locale())); 132 133 return $chain->next($self, $params, $chain); 134}; -
lithium\util\collection\Filters::run()
/var/www/libraries/lithium/util/collection/Filters.php: 183
178 } 179 } 180 181 $chain = new Filters($options); 182 $next = $chain->rewind(); 183 return $next($class, $params, $chain); 184 } 185 186 /** 187 * Provides short-hand convenience syntax for filter chaining. 188 * -
lithium\core\StaticObject::_filter()
/var/www/libraries/lithium/core/StaticObject.php: 126
121 if (!isset(static::$_methodFilters[$class][$method])) { 122 static::$_methodFilters += array($class => array()); 123 static::$_methodFilters[$class][$method] = array(); 124 } 125 $data = array_merge(static::$_methodFilters[$class][$method], $filters, array($callback)); 126 return Filters::run($class, $params, compact('data', 'class', 'method')); 127 } 128 129 /** 130 * Gets and caches an array of the parent methods of a class. 131 * -
lithium\action\Dispatcher::_callable()
/var/www/libraries/lithium/action/Dispatcher.php: 201
196 try { 197 return Libraries::instance('controllers', $controller, $options); 198 } catch (ClassNotFoundException $e) { 199 throw new DispatchException("Controller `{$controller}` not found.", null, $e); 200 } 201 }); 202 } 203 204 /** 205 * Invokes the callable object returned by `_callable()`, and returns the results, usually a 206 * `Response` object instance. -
lithium\core\StaticObject::invokeMethod()
/var/www/libraries/lithium/core/StaticObject.php: 75
70 case 1: 71 return static::$method($params[0]); 72 case 2: 73 return static::$method($params[0], $params[1]); 74 case 3: 75 return static::$method($params[0], $params[1], $params[2]); 76 case 4: 77 return static::$method($params[0], $params[1], $params[2], $params[3]); 78 case 5: 79 return static::$method($params[0], $params[1], $params[2], $params[3], $params[4]); 80 default: -
lithium\action\Dispatcher::run()::{closure} @ 109
/var/www/libraries/lithium/action/Dispatcher.php: 121
116 $params = $self::applyRules($result->params); 117 118 if (!$params) { 119 throw new DispatchException('Could not route request.'); 120 } 121 $callable = $self::invokeMethod('_callable', array($result, $params, $options)); 122 return $self::invokeMethod('_call', array($callable, $result, $params)); 123 }); 124 } 125 126 /** -
lithium\util\collection\Filters::next()
/var/www/libraries/lithium/util/collection/Filters.php: 202
197 public function next($self, $params, $chain) { 198 if (empty($self) || empty($chain)) { 199 return parent::next(); 200 } 201 $next = parent::next(); 202 return $next($self, $params, $chain); 203 } 204 205 /** 206 * Gets the method name associated with this filter chain. This is the method being filtered. 207 * -
/var/www/app/config/bootstrap/action.php::{closure} @ 42
/var/www/app/config/bootstrap/action.php: 52
47 continue; 48 } 49 $file = "{$config['path']}/config/routes.php"; 50 file_exists($file) ? include $file : null; 51 } 52 return $chain->next($self, $params, $chain); 53 }); 54 55 -
lithium\util\collection\Filters::next()
/var/www/libraries/lithium/util/collection/Filters.php: 202
197 public function next($self, $params, $chain) { 198 if (empty($self) || empty($chain)) { 199 return parent::next(); 200 } 201 $next = parent::next(); 202 return $next($self, $params, $chain); 203 } 204 205 /** 206 * Gets the method name associated with this filter chain. This is the method being filtered. 207 * -
/var/www/app/config/bootstrap/cache.php::{closure} @ 48
/var/www/app/config/bootstrap/cache.php: 58
53 54 if ($cache = Cache::read('default', $key)) { 55 $cache = (array) $cache + Libraries::cache(); 56 Libraries::cache($cache); 57 } 58 $result = $chain->next($self, $params, $chain); 59 60 if ($cache != Libraries::cache()) { 61 Cache::write('default', $key, Libraries::cache(), '+1 day'); 62 } 63 return $result; -
lithium\util\collection\Filters::next()
/var/www/libraries/lithium/util/collection/Filters.php: 202
197 public function next($self, $params, $chain) { 198 if (empty($self) || empty($chain)) { 199 return parent::next(); 200 } 201 $next = parent::next(); 202 return $next($self, $params, $chain); 203 } 204 205 /** 206 * Gets the method name associated with this filter chain. This is the method being filtered. 207 * -
lithium\core\ErrorHandler::apply()::{closure} @ 284
/var/www/libraries/lithium/core/ErrorHandler.php: 286
281 $wrap = static::$_exceptionHandler; 282 $_self = get_called_class(); 283 284 $filter = function($self, $params, $chain) use ($_self, $conditions, $handler, $wrap) { 285 try { 286 return $chain->next($self, $params, $chain); 287 } catch (Exception $e) { 288 if (!$_self::matches($e, $conditions)) { 289 throw $e; 290 } 291 return $handler($wrap($e, true), $params); -
lithium\util\collection\Filters::next()
/var/www/libraries/lithium/util/collection/Filters.php: 202
197 public function next($self, $params, $chain) { 198 if (empty($self) || empty($chain)) { 199 return parent::next(); 200 } 201 $next = parent::next(); 202 return $next($self, $params, $chain); 203 } 204 205 /** 206 * Gets the method name associated with this filter chain. This is the method being filtered. 207 * -
/var/www/app/libraries/li3_docs/config/bootstrap.php::{closure} @ 26
/var/www/app/libraries/li3_docs/config/bootstrap.php: 32
27 $indexPath = Libraries::get(true, 'path') . '/resources/docs.index.json'; 28 29 if (file_exists($indexPath) && is_readable($indexPath)) { 30 Code::index((array) json_decode(file_get_contents($indexPath), true)); 31 } 32 $result = $chain->next($self, $params, $chain); 33 34 if (($index = Code::index()) && is_array($index) && is_writable(dirname($indexPath))) { 35 file_put_contents($indexPath, json_encode($index)); 36 } 37 return $result; -
lithium\util\collection\Filters::run()
/var/www/libraries/lithium/util/collection/Filters.php: 183
178 } 179 } 180 181 $chain = new Filters($options); 182 $next = $chain->rewind(); 183 return $next($class, $params, $chain); 184 } 185 186 /** 187 * Provides short-hand convenience syntax for filter chaining. 188 * -
lithium\core\StaticObject::_filter()
/var/www/libraries/lithium/core/StaticObject.php: 126
121 if (!isset(static::$_methodFilters[$class][$method])) { 122 static::$_methodFilters += array($class => array()); 123 static::$_methodFilters[$class][$method] = array(); 124 } 125 $data = array_merge(static::$_methodFilters[$class][$method], $filters, array($callback)); 126 return Filters::run($class, $params, compact('data', 'class', 'method')); 127 } 128 129 /** 130 * Gets and caches an array of the parent methods of a class. 131 * -
lithium\action\Dispatcher::run()
/var/www/libraries/lithium/action/Dispatcher.php: 123
118 if (!$params) { 119 throw new DispatchException('Could not route request.'); 120 } 121 $callable = $self::invokeMethod('_callable', array($result, $params, $options)); 122 return $self::invokeMethod('_call', array($callable, $result, $params)); 123 }); 124 } 125 126 /** 127 * Attempts to apply a set of formatting rules from `$_rules` to a `$params` array, where each 128 * formatting rule is applied if the key of the rule in `$_rules` is present and not empty in -
[main]
/var/www/app/webroot/index.php: 42
37 * @see lithium\action\Response 38 * @see lithium\action\Dispatcher 39 * @see lithium\net\http\Router 40 * @see lithium\action\Controller 41 */ 42 echo lithium\action\Dispatcher::run(new lithium\action\Request()); 43 44
