Skip to content

Commit b85990f

Browse files
committed
Merge branch 'PHP-5.6'
* PHP-5.6: Escape non-printable characters in the junit XML output
2 parents 40fd858 + eb2bd85 commit b85990f

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

run-tests.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2708,6 +2708,9 @@ function junit_mark_test_as($type, $file_name, $test_name, $time = null, $messag
27082708
junit_suite_record($suite, 'execution_time', $time);
27092709

27102710
$escaped_details = htmlspecialchars($details, ENT_QUOTES, 'UTF-8');
2711+
$escaped_details = preg_replace_callback('/[\0-\x08\x0B\x0C\x0E-\x1F]/', function ($c) {
2712+
return sprintf('[[0x%02x]]', ord($c[0]));
2713+
}, $escaped_details);
27112714
$escaped_message = htmlspecialchars($message, ENT_QUOTES, 'UTF-8');
27122715

27132716
$escaped_test_name = basename($file_name) . ' - ' . htmlspecialchars($test_name, ENT_QUOTES);

0 commit comments

Comments
 (0)