Skip to content

Commit abfd977

Browse files
committed
Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4: Escape non-printable characters in the junit XML output
2 parents 56bcb22 + 92d54f8 commit abfd977

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
@@ -2704,6 +2704,9 @@ function junit_mark_test_as($type, $file_name, $test_name, $time = null, $messag
27042704
junit_suite_record($suite, 'execution_time', $time);
27052705

27062706
$escaped_details = htmlspecialchars($details, ENT_QUOTES, 'UTF-8');
2707+
$escaped_details = preg_replace_callback('/[\0-\x08\x0B\x0C\x0E-\x1F]/', function ($c) {
2708+
return sprintf('[[0x%02x]]', ord($c[0]));
2709+
}, $escaped_details);
27072710
$escaped_message = htmlspecialchars($message, ENT_QUOTES, 'UTF-8');
27082711

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

0 commit comments

Comments
 (0)