1
0
mirror of https://github.com/maximebf/php-debugbar.git synced 2025-07-15 05:46:31 +02:00

Merge pull request #132 from barryvdh/patch-8

Force convert to UTF-8
This commit is contained in:
Maxime Bouroumeau-Fuseau
2014-06-20 18:02:17 +02:00

View File

@ -215,6 +215,13 @@ class DebugBar implements ArrayAccess
$this->data[$name] = $collector->collect();
}
// Remove all invalid (non UTF-8) characters
array_walk_recursive($this->data, function(&$item){
if (is_string($item) && !mb_check_encoding($item, 'UTF-8')) {
$item = mb_convert_encoding($item, 'UTF-8', 'UTF-8');
}
});
if ($this->storage !== null) {
$this->storage->save($this->getCurrentRequestId(), $this->data);
}