Skip to content

Commit

Permalink
Use array_pad() to prevent undefined key warning
Browse files Browse the repository at this point in the history
Per @Klap-in's review comments.
  • Loading branch information
dregad committed Sep 26, 2022
1 parent b0b9137 commit da3929b
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions syntax.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,9 @@ function handle($match, $state, $pos, Doku_Handler $handler) {
$type = 'word';
}

// Add trailing separator to ensure we always have 2 entries in the array
list($num, $ns) = explode('>', $match . '>', 2);
$ns = rtrim($ns, '>');
list($junk, $num) = explode(':', $num . ':', 2);
$num = rtrim($num, ':');
// Ensure we always have 2 entries in the exploded array
list($num, $ns) = array_pad(explode('>', $match . '>', 2), 2, '');
list($junk, $num) = array_pad(explode(':', $num . ':', 2), 2, '');

// Set default flag values
$flags = [
Expand Down

0 comments on commit da3929b

Please sign in to comment.