@@ -468,12 +468,16 @@ |
||
468 | 468 | |
469 | 469 | // 4-byte Unicode characters are not permitted within user names where db_mb4 is false and character set is non-UTF |
470 | 470 | if (!$smcFunc['db_mb4'] && max(array_map('ord', str_split($regOptions['username']))) >= 240 && stripos($context['character_set'], 'utf') !== false) |
471 | - $regOptions['username'] = preg_replace_callback('/[\x{10000}-\x{10FFFF}]/u', function($name) use($smcFunc){return $smcFunc['htmlspecialchars']($name[0], ENT_COMPAT, $context['character_set']);}, $regOptions['username']); |
|
471 | + $regOptions['username'] = preg_replace_callback('/[\x{10000}-\x{10FFFF}]/u', function($name) use($smcFunc) |
|
472 | + { |
|
473 | +return $smcFunc['htmlspecialchars']($name[0], ENT_COMPAT, $context['character_set']);}, $regOptions['username']); |
|
472 | 474 | // if the character set is non-UTF then characters would be replaced by ???'s therefore do not allow it but purposely change them for logging |
473 | 475 | elseif (max(array_map('ord', str_split($regOptions['username']))) >= 240 && stripos($context['character_set'], 'utf') === false) |
474 | 476 | { |
475 | 477 | $reg_errors[] = array('lang', 'name_invalid_character'); |
476 | - preg_replace_callback('/[\x{10000}-\x{10FFFF}]/u', function($name) use($smcFunc){return "\xEF\xBF\xBD";}, $regOptions['username']); |
|
478 | + preg_replace_callback('/[\x{10000}-\x{10FFFF}]/u', function($name) use($smcFunc) |
|
479 | + { |
|
480 | +return "\xEF\xBF\xBD";}, $regOptions['username']); |
|
477 | 481 | } |
478 | 482 | |
479 | 483 | // @todo Separate the sprintf? |