Skip to content

Commit 9988e85

Browse files
committed
Fix Undefined array key warning
E_WARNING: Undefined array key 3 in ./inc/media.php(1700) E_WARNING: Trying to access array offset on value of type null in ./inc/media.php(1700) This happens when the media manager is called with ns parameter set to a value higher than the last namespace defined in the wiki. Fixes dokuwiki#4276
1 parent 5a4a5e0 commit 9988e85

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

inc/media.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1697,7 +1697,7 @@ function media_nstree($ns)
16971697
else $tmp_ns = $part;
16981698

16991699
// find the namespace parts or insert them
1700-
while ($data[$pos]['id'] != $tmp_ns) {
1700+
while (array_key_exists($pos, $data) && $data[$pos]['id'] != $tmp_ns) {
17011701
if (
17021702
$pos >= count($data) ||
17031703
($data[$pos]['level'] <= $level + 1 && Sort::strcmp($data[$pos]['id'], $tmp_ns) > 0)

0 commit comments

Comments
 (0)