Skip to content

Commit

Permalink
Add warning note about specific use of strtok
Browse files Browse the repository at this point in the history
  • Loading branch information
eldering committed Jan 16, 2024
1 parent fb49f38 commit 98157a2
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions webapp/src/Twig/TwigExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,10 @@ public function codeEditor(
sprintf($editor, $code, $editable ? 'false' : 'true', $mode, $extraForEdit));
}

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

0 comments on commit 98157a2

Please sign in to comment.