Skip to content
This repository was archived by the owner on Oct 15, 2025. It is now read-only.

Commit 181fc1a

Browse files
author
Flo Faber
committed
Fixed critical paring bug when using MPD_CMD_READ_LIST_SINGLE - mode
1 parent 25ac069 commit 181fc1a

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

src/Socket.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,11 @@ protected function parse(array $lines, int $mode = MPD_CMD_READ_NORMAL, array $l
530530
$tmp[$k] = $v;
531531
}
532532

533+
// set the first encountered key if there isn't already one
534+
if(($mode === MPD_CMD_READ_LIST || $mode === MPD_CMD_READ_LIST_SINGLE || $mode === MPD_CMD_READ_GROUP) && $first_key === NULL){
535+
$first_key = $k;
536+
}
537+
533538
// omfg
534539
// ok,ok. If we read a list and the `key` of the next line is either in `$list_starts` or is equal to `$first_key` we push the list-item to the list of items.
535540
if($mode === MPD_CMD_READ_LIST &&
@@ -546,10 +551,7 @@ protected function parse(array $lines, int $mode = MPD_CMD_READ_NORMAL, array $l
546551
$b[] = $v;
547552
}
548553

549-
// set the first encountered key if there isn't already one
550-
if(($mode === MPD_CMD_READ_LIST || $mode === MPD_CMD_READ_LIST_SINGLE || $mode === MPD_CMD_READ_GROUP) && $first_key === NULL){
551-
$first_key = $k;
552-
}
554+
553555

554556
}
555557

0 commit comments

Comments
 (0)