nystudio107 / retour

DEPRECATED Retour allows you to intelligently redirect legacy URLs, so that you don't lose SEO value when rebuilding & restructuring a website.
Other
168 stars 24 forks source link

Uncaught ErrorException: "iconv(): Detected an incomplete multibyte character in input string" #112

Open brandonkelly opened 5 years ago

brandonkelly commented 5 years ago

If you go to a URL with an incomplete multibyte character in the URI, an error will occur that Retour doesn’t catch.

Steps to reproduce:

  1. Have Retour installed
  2. Go to /test%F2%FB

Expected behavior:

404 error

Actual:

A 500 response is given, with this in the logs:

2019-02-20 03:32:21 [-][18][msol1tbrqs5l93vb53nifir9bm][error][yii\base\ErrorException:1] yii\base\ErrorException: Uncaught yii\base\ErrorException: iconv(): Detected an incomplete multibyte character in input string in /var/app/current/vendor/nystudio107/craft-retour/src/helpers/Text.php:91
Stack trace:
#0 /var/app/current/vendor/craftcms/cms/src/web/ErrorHandler.php(76): yii\base\ErrorHandler->handleError(8, 'iconv(): Detect...', '/var/app/curren...', 91)
#1 [internal function]: craft\web\ErrorHandler->handleError(8, 'iconv(): Detect...', '/var/app/curren...', 91, Array)
#2 /var/app/current/vendor/nystudio107/craft-retour/src/helpers/Text.php(91): iconv('', 'UTF-8//IGNORE', '/testfooo\xF2\xFB')
#3 /var/app/current/vendor/nystudio107/craft-retour/src/validators/DbStringValidator.php(52): nystudio107\retour\helpers\Text::cleanupText('/testfooo\xF2\xFB')
#4 /var/app/current/vendor/yiisoft/yii2/validators/Validator.php(267): nystudio107\retour\validators\DbStringValidator->validateAttribute(Object(nystudio107\retour\models\Stats), 'redirectSrcUrl')
#5 /var/app/current/vendor/yiisoft/yii2/base/Model.php(367): yii\validators\ in /var/app/current/vendor/nystudio107/craft-retour/src/helpers/Text.php:91
Stack trace:
#0 [internal function]: yii\base\ErrorHandler->handleFatalError()
#1 {main}
2019-02-20 03:32:20 [-][18][msol1tbrqs5l93vb53nifir9bm][info][application] $_GET = [
    'p' => 'test�'
]