Fix warnings about assignment in condition
authorMatthias Schmidt <gravatronics@live.com>
Thu, 26 May 2016 14:07:52 +0000 (16:07 +0200)
committerMatthias Schmidt <gravatronics@live.com>
Thu, 26 May 2016 14:27:35 +0000 (16:27 +0200)
files/lib/data/conversation/Conversation.class.php
files/lib/data/conversation/ConversationAction.class.php
files/lib/data/conversation/ConversationEditor.class.php
files/lib/data/conversation/ConversationParticipantList.class.php
files/lib/data/conversation/UserConversationList.class.php
files/lib/data/conversation/ViewableConversation.class.php
files/lib/system/clipboard/action/ConversationClipboardAction.class.php
files/lib/system/worker/ConversationRebuildDataWorker.class.php

index fc86df59c60051e5bdfaf4fea53213f932ffd086..2f7d797d447e58c6ba08c83ef79ad8fe8fe783f9 100644 (file)
@@ -181,7 +181,7 @@ class Conversation extends DatabaseObject implements IRouteController, ITitledLi
                $statement = WCF::getDB()->prepareStatement($sql);
                $statement->execute($conditionBuilder->getParameters());
                $conversations = [];
-               while ($row = $statement->fetchArray()) {
+               while (($row = $statement->fetchArray())) {
                        $conversations[$row['conversationID']] = new Conversation(null, $row);
                }
                
@@ -340,7 +340,7 @@ class Conversation extends DatabaseObject implements IRouteController, ITitledLi
                        ".$conditions;
                $statement = WCF::getDB()->prepareStatement($sql);
                $statement->execute($conditions->getParameters());
-               while ($row = $statement->fetchArray()) {
+               while (($row = $statement->fetchArray())) {
                        $index = array_search($row['conversationID'], $conversationIDs);
                        unset($conversationIDs[$index]);
                }
@@ -357,7 +357,7 @@ class Conversation extends DatabaseObject implements IRouteController, ITitledLi
                                ".$conditions;
                        $statement = WCF::getDB()->prepareStatement($sql);
                        $statement->execute($conditions->getParameters());
-                       while ($row = $statement->fetchArray()) {
+                       while (($row = $statement->fetchArray())) {
                                $index = array_search($row['conversationID'], $conversationIDs);
                                unset($conversationIDs[$index]);
                        }
index 378e9d30529755158e977005c11d82482911b694..9154ad22b91a0cdc6465c1486fd48b8cfdcc9967 100644 (file)
@@ -850,7 +850,7 @@ class ConversationAction extends AbstractDatabaseObjectAction implements IClipbo
                $statement->execute($conditionBuilder->getParameters());
                
                $objectIDs = [];
-               while ($row = $statement->fetchArray()) {
+               while (($row = $statement->fetchArray())) {
                        if (!$row['messages']) {
                                continue;
                        }
index c8cc2fd198403d648951a905d4ec918264fa333d..97d26c31894b1a1b253eac344c31362e6688e14c 100644 (file)
@@ -67,7 +67,7 @@ class ConversationEditor extends DatabaseObjectEditor {
                                ".$conditions;
                        $statement = WCF::getDB()->prepareStatement($sql);
                        $statement->execute($conditions->getParameters());
-                       while ($row = $statement->fetchArray()) {
+                       while (($row = $statement->fetchArray())) {
                                $usernames[$row['userID']] = $row['username'];
                        }
                }
@@ -140,7 +140,6 @@ class ConversationEditor extends DatabaseObjectEditor {
         * Updates the participant summary of this conversation.
         */
        public function updateParticipantSummary() {
-               $users = [];
                $sql = "SELECT          participantID AS userID, hideConversation, username
                        FROM            wcf".WCF_N."_conversation_to_user
                        WHERE           conversationID = ?
@@ -149,11 +148,8 @@ class ConversationEditor extends DatabaseObjectEditor {
                        ORDER BY        username";
                $statement = WCF::getDB()->prepareStatement($sql, 5);
                $statement->execute([$this->conversationID, $this->userID]);
-               while ($row = $statement->fetchArray()) {
-                       $users[] = $row;
-               }
                
-               $this->update(['participantSummary' => serialize($users)]);
+               $this->update(['participantSummary' => serialize($statement->fetchAll(\PDO::FETCH_ASSOC))]);
        }
        
        /**
index 3f4b522e52d25ce7c137b0558510c0fffe5ab022..702156cc469c4a9d89892c99b9549ecd1894742e 100644 (file)
@@ -96,7 +96,7 @@ class ConversationParticipantList extends UserProfileList {
                $statement = WCF::getDB()->prepareStatement($sql);
                $statement->execute([$this->conversationID]);
                $i = 0;
-               while ($row = $statement->fetchArray()) {
+               while (($row = $statement->fetchArray())) {
                        // create fake user profiles
                        $this->objects['x'.(++$i)] = UserProfile::getGuestUserProfile($row['username']);
                        $this->indexToObject[] = 'x'.$i;
index 7f3e8e63f5a7585157b7ea3ebf07099cd1e70884..6fbe76fd1ca159e0b7715bf840681c325d3e44ad 100644 (file)
@@ -202,7 +202,7 @@ class UserConversationList extends ConversationList {
                $statement = WCF::getDB()->prepareStatement($sql);
                $statement->execute($conditions->getParameters());
                $data = [];
-               while ($row = $statement->fetchArray()) {
+               while (($row = $statement->fetchArray())) {
                        if (!isset($data[$row['conversationID']])) {
                                $data[$row['conversationID']] = [];
                        }
index a5fc7659988955b92ddd6f9e88f2bfd9aa20cfeb..ce8fda81e2586440193a764f06dc0a05647a3652 100644 (file)
@@ -245,7 +245,7 @@ class ViewableConversation extends DatabaseObjectDecorator {
                                ".$conditions;
                        $statement = WCF::getDB()->prepareStatement($sql);
                        $statement->execute($conditions->getParameters());
-                       while ($row = $statement->fetchArray()) {
+                       while (($row = $statement->fetchArray())) {
                                $conversation->assignLabel($labels[$row['labelID']]);
                        }
                }
index 6b9a8e51b797451dcc252a1a424302652d7f38bb..0cbb082da8a2df44d16aee8848625e8895b98acf 100644 (file)
@@ -142,7 +142,7 @@ class ConversationClipboardAction extends AbstractClipboardAction {
                                ".$conditions;
                        $statement = WCF::getDB()->prepareStatement($sql);
                        $statement->execute($conditions->getParameters());
-                       while ($row = $statement->fetchArray()) {
+                       while (($row = $statement->fetchArray())) {
                                $index = array_search($row['conversationID'], $conversationIDs);
                                unset($conversationIDs[$index]);
                        }
@@ -222,7 +222,7 @@ class ConversationClipboardAction extends AbstractClipboardAction {
                $statement = WCF::getDB()->prepareStatement($sql);
                $statement->execute($conditions->getParameters());
                $lastVisitTime = [];
-               while ($row = $statement->fetchArray()) {
+               while (($row = $statement->fetchArray())) {
                        $lastVisitTime[$row['conversationID']] = $row['lastVisitTime'];
                }
                
index f519bd575b8ec22a3cc1bb7a2e0e5c4fefd53c3e..2a8491dc05049e28cd1c83e1e3792cdd5f072609 100644 (file)
@@ -145,7 +145,7 @@ class ConversationRebuildDataWorker extends AbstractRebuildDataWorker {
                        // get participant summary
                        $participantStatement->execute([$conversation->conversationID, $conversation->userID, 0]);
                        $users = [];
-                       while ($row = $participantStatement->fetchArray()) {
+                       while (($row = $participantStatement->fetchArray())) {
                                $users[] = $row;
                        }
                        $data['participantSummary'] = serialize($users);