Skip to content

Commit 98157a2

Browse files
committed
Add warning note about specific use of strtok
1 parent fb49f38 commit 98157a2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

webapp/src/Twig/TwigExtension.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -862,6 +862,10 @@ public function codeEditor(
862862
sprintf($editor, $code, $editable ? 'false' : 'true', $mode, $extraForEdit));
863863
}
864864

865+
// This function expects $difftext to be in unified diff format. In
866+
// particular each line is expected to contain at least some character
867+
// (that is, a leading space, + or -) so that strtok does not gobble up
868+
// multiple empty lines in one go.
865869
protected function parseSourceDiff(string $difftext): string
866870
{
867871
$line = strtok($difftext, "\n"); // first line

0 commit comments

Comments
 (0)