XF 2.1 URIEncoded characters in querystring not working with $request->filter() ?

mazzly

Well-known member
I'm extending a vb->xenforo redirection for member.php of my forum since some paths are missing.

The relevant parts of the script looks as follows (member.php):
Code:
require($fileDir . '/src/XF.php');
XF::start($fileDir);

$app = XF::setupApp('XF\Pub\App');
$router = $app->router('public');
$request = $app->request();

$input = $request->filter([
        'u' => 'uint',
        'userid' => 'uint',
        'username' => 'str'
]);

if ($input['username']) 
{
        $finder = XF::finder('XF:User');
        $user = $finder->where('username', $input['username'])->fetchOne();
        if ($user)
        {
                $target = $router->buildLink('canonical:members', ['user_id' => $user->user_id]);
        }
}

$response = $app->response();
$response->redirect($request->convertToAbsoluteUri($target), 302); //Switch to 301 once working
$response->send($request);

Fetching the username "foobar" works:
/member.php?username=foobar

Fetching the username "fôôbar" doesn't work:
/member.php?username=f%F4%F4bar

I tried echoing $input['username'] and if umlaut/accent is included, it becomes empty..

How to make it also allow special URIEncoded characters? Is this something I'm missing? or server config being wrong?
 
Back
Top Bottom