The project does not start, an error in this code falls, the backend is not very good, so I ask the question how to fix it?

class CurrentSiteMiddleware extends Middleware { public function processRequest(Request $request) { if (!Console::isCli()) { $modelClass = Mindy::app()->getModule('Sites')->modelClass; $model = $modelClass::objects()->filter([ 'domain' => $this->decode($request->http->getHost()), ])->get(); if ($model !== null) { Mindy::app()->getModule('Sites')->setSite($model); } } } public function decode($value) { if (function_exists('idn_to_utf8')) { return idn_to_utf8($value); } elseif (class_exists('\True\Punycode')) { $pc = new \True\Punycode(Mindy::app()->locale['charset']); return $pc->decode($value); } Mindy::app()->logger->error('CurrentSiteMiddleware required php intl or \\True\\Punycode packages'); return $value; } } 

  • At a minimum, indicate the error and accordingly it is not clear what is in your Middleware class - Dmitriy

1 answer 1

It's simple - you call the function idn_to_utf8 ($ value)

in $ value you throw INTL_IDNA_VARIANT_2003

7.2.0 INTL_IDNA_VARIANT_2003 is deprecated, use INTL_IDNA_VARIANT_UTS46 instead.

  • you still need to understand where you still call CurrentSiteMiddleware :: decode () in your case, you need to understand why $ request-> http-> getHost () returns INTL_IDNA_VARIANT_2003 - Mcile