From e5ab98530ee80a412c1b130f8dedc15b7d52eae7 Mon Sep 17 00:00:00 2001 From: Mihail Comanescu Date: Wed, 28 Dec 2016 19:26:12 -0500 Subject: [PATCH 1/2] controller : fix unknown [] operator for string bug --- controller/categorycontroller.php | 10 +++++----- controller/musiccontroller.php | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/controller/categorycontroller.php b/controller/categorycontroller.php index d0b830c9..707991ad 100644 --- a/controller/categorycontroller.php +++ b/controller/categorycontroller.php @@ -61,7 +61,7 @@ public function getCategory(){ $playlists= $this->getCategoryforUser($category); if(is_array($playlists)){ - $aPlayLists=''; + $aPlayLists= array(); foreach($playlists as $playinfo){ $aPlayLists[]=['info' => $playinfo, 'songids' => $this->getSongIdsForCategory($category,$playinfo['id'])]; } @@ -127,7 +127,7 @@ private function getCategoryforUser($category){ $stmt =$this->db->prepareQuery($SQL); $result = $stmt->execute(array($this->userId)); - $aPlaylists=''; + $aPlaylists=array(); while( $row = $result->fetchRow()) { $bg = $this->genColorCodeFromText(trim($row['name']),40,8); $row['backgroundColor']=$bg; @@ -135,10 +135,10 @@ private function getCategoryforUser($category){ $aPlaylists[]=$row; } - if(is_array($aPlaylists)){ - return $aPlaylists; - }else{ + if(empty($aPlaylists)){ return false; + }else{ + return $aPlaylists; } } diff --git a/controller/musiccontroller.php b/controller/musiccontroller.php index b9ed9084..701eecdd 100755 --- a/controller/musiccontroller.php +++ b/controller/musiccontroller.php @@ -253,7 +253,7 @@ public function loadSongs(){ $stmt = $this->db->prepareQuery($SQL); $result = $stmt->execute(array($this->userId)); - $aSongs=''; + $aSongs=array(); while( $row = $result->fetchRow()) { $file_not_found = false; @@ -275,10 +275,10 @@ public function loadSongs(){ $this->deleteFromDB($row['id'],$row['album_id'],$row['artist_id'],$row['file_id']); } } - if(is_array($aSongs)){ - return $aSongs; - }else{ + if(empty($aSongs)){ return false; + }else{ + return $aSongs; } } From af3a5f623a22797b8d26cb6e72a413bed98e5ca9 Mon Sep 17 00:00:00 2001 From: Mihail Comanescu Date: Wed, 28 Dec 2016 19:27:52 -0500 Subject: [PATCH 2/2] 3rdparty : fixed unknow [] operator bug when appending to info['warning'] --- 3rdparty/getid3/module.audio.mp3.php | 1 + 1 file changed, 1 insertion(+) diff --git a/3rdparty/getid3/module.audio.mp3.php b/3rdparty/getid3/module.audio.mp3.php index cba36193..6dc0f45b 100755 --- a/3rdparty/getid3/module.audio.mp3.php +++ b/3rdparty/getid3/module.audio.mp3.php @@ -923,6 +923,7 @@ public function decodeMPEGaudioHeader($offset, &$info, $recursivesearch=true, $S // $info['warning'][] = 'Too much data in file: expecting '.$ExpectedNumberOfAudioBytes.' bytes of audio data, found '.($info['avdataend'] - $info['avdataoffset']).' ('.(($info['avdataend'] - $info['avdataoffset']) - $ExpectedNumberOfAudioBytes).' bytes too many)'; // } } else { + if (! is_array($info['warning'])) $info['warning'] = array(); $info['warning'][] = 'Too much data in file: expecting '.$ExpectedNumberOfAudioBytes.' bytes of audio data, found '.($info['avdataend'] - $info['avdataoffset']).' ('.(($info['avdataend'] - $info['avdataoffset']) - $ExpectedNumberOfAudioBytes).' bytes too many)'; } }