eveseat / eseye

👾 A Standalone, Dynamic ESI (EVE Swagger Interface) Client Library written in PHP
GNU General Public License v2.0
50 stars 30 forks source link

Invalid UTF-16 breaks the parser #52

Open wfjsw opened 4 years ago

wfjsw commented 4 years ago

It is actually a PHP issue, but I have seen random characters in CharacterInfo.description broke the json_decode parser without any exception thrown, thus is difficult to debug.

Solution part 1:

https://github.com/eveseat/eseye/blob/master/src/Containers/EsiResponse.php#L104 Add JSON_THROW_ON_ERROR flag to json_decode to make it easier to debug such error

Solution part 2:

Add a sanitizer as described in https://stackoverflow.com/questions/58674104/php-json-decode-does-not-work-with-single-unpaired-surrogate-caused-by-node-12-w

Not a clean way, though.

P.S. an example of such error: https://telemetry.eve.ac/share/issue/09f1abc0a4fb4bb09ee1f1f42b4474cb/

wfjsw commented 4 years ago

Note: we should consider these plain-text-response request when applying JSON_THROW_ON_ERROR, for example EsiStatus.