Skip to content

Commit 2fbed1d

Browse files
committed
[TwigBridge] Prevent code extension to display warning
1 parent 25d8e23 commit 2fbed1d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Templating/Helper/CodeHelper.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,9 @@ public function fileExcerpt($file, $line)
131131
}
132132
}
133133

134-
$code = highlight_file($file, true);
134+
// highlight_file could throw warnings
135+
// see https://bugs.php.net/bug.php?id=25725
136+
$code = @highlight_file($file, true);
135137
// remove main code/span tags
136138
$code = preg_replace('#^<code.*?>\s*<span.*?>(.*)</span>\s*</code>#s', '\\1', $code);
137139
$content = preg_split('#<br />#', $code);

0 commit comments

Comments
 (0)