From 649d3b3eb41a9b02f3a4826d22ea2422db646a99 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Mon, 18 Sep 2017 19:55:54 +0200 Subject: Test: Replace unprintable characters when dumping variables Signed-off-by: Florian Pritz --- application/third_party/test-more-php/Test-More-OO.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'application/third_party/test-more-php') diff --git a/application/third_party/test-more-php/Test-More-OO.php b/application/third_party/test-more-php/Test-More-OO.php index 005c7dc01..7ce9f9421 100755 --- a/application/third_party/test-more-php/Test-More-OO.php +++ b/application/third_party/test-more-php/Test-More-OO.php @@ -87,6 +87,11 @@ class TestMore extends TestSimple { $ret = ob_get_clean(); $ret = preg_replace("/^[^\n]*\n/", "", $ret); $ret = preg_replace("/\n$/", "", $ret); + # replace unprintable characters with questionmarks + $old = ini_get("mbstring.substitute_character"); + ini_set("mbstring.substitute_character", "?"); + $ret = mb_convert_encoding($ret, 'UTF-8', 'UTF-8'); + ini_set("mbstring.substitute_character", $old); return $ret; } -- cgit v1.2.3-24-g4f1b