MindscapeHQ/raygun4php

iconv(): Detected an illegal character in input string

Closed this issue · 3 comments

We've started to get a few of these errors come through. This is the stack trace we're seeing:

#0 iconv(): Detected an illegal character in input string:: called at [/home/example/vendor/mindscape/raygun4php/src/Raygun4php/RaygunClient.php:414]
#1 DDC\Error::logToRaygun called at [/home/example/vendor/drugscom/error/src/DDC/error.php:367]
#2 DDC\Error::log called at [/home/example/vendor/drugscom/error/src/DDC/error.php:190]
#3 DDC\Error::customErrorHandler called at [:0]
#4 ::iconv called at [/home/example/vendor/mindscape/raygun4php/src/Raygun4php/RaygunClient.php:414]
#5 Raygun4php\RaygunClient::Raygun4php\{closure} called at [:0]
#6 ::preg_replace_callback called at [/home/example/vendor/mindscape/raygun4php/src/Raygun4php/RaygunClient.php:414]
#7 Raygun4php\RaygunClient::toJsonRemoveUnicodeSequences called at [/home/example/vendor/mindscape/raygun4php/src/Raygun4php/RaygunClient.php:324]
#8 Raygun4php\RaygunClient::Send called at [/home/example/vendor/mindscape/raygun4php/src/Raygun4php/RaygunClient.php:99]
#9 iconv(): Detected an illegal character in input string:: called at [/home/example/vendor/mindscape/raygun4php/src/Raygun4php/RaygunClient.php:414]
#10 DDC\Error::logToRaygun called at [/home/example/vendor/drugscom/error/src/DDC/error.php:367]
#11 DDC\Error::log called at [/home/example/vendor/drugscom/error/src/DDC/error.php:137]
#12 DDC\Error::customErrorShutdown called at [:0]

+1 on version 1.8.2

Turns out that the custom data contained a emoiji unicode character like \ud83d\ude10 and therefore the RayGunClient fails to convert to the requested encoding with iconv.

My workaround was to strip out unicodes before sending data to the RayGunClient.
Hope this might be helpful for other users.

Haven't seen these for a while, closing off.