c0nnr Posted September 2, 2014 Share Posted September 2, 2014 (edited) I'm making forums at the minute and everything is going well, apart from these stupid errors that I can't seem to get rid of for the life of me. It is frustrating me so much! I've looked through the code and cannot find anything wrong. The first error appears at the top of my forums whenever you're logged in about strict standards. This is what the error says: Line 6 of viewthread.php is - require('../structure/forum.thread.php');; Here is the code of the thread::canView() and thread::canView() that is located within my structure. thread::canView function below public function canView($id, $username, $powerLevel) { //extract thread details $thread = $this->database->processQuery("SELECT `parent`,`hidden` FROM `threads` WHERE `id` = ? LIMIT 1", array($id), true); $canSee = true; //get the parent's type $parent = $this->database->processQuery("SELECT `type` FROM `forums` WHERE `id` = ? LIMIT 1", array($thread[0]['parent']), true); if($parent[0]['type'] > 2) { //if it's a protected forum, make sure they are the thread owner or staff in order to view if($parent[0]['type'] == 3 && ($username != $thread[0]['username'] && $powerLevel < 3)) $canSee = false; //forum moderator forum, let only moderators view it if($parent[0]['type'] == 4 && $powerLevel < 3) $canSee = false; //administrator forum, let only administrators see it if($parent[0]['type'] == 5 && $powerLevel < 4) $canSee = false; //member forum, let only members see it if($parent[0]['type'] == 6 && !isset($_COOKIE['user'])) $canSee = false; } //only let staff view hidden threads if($thread[0]['hidden'] == 1 && $powerLevel < 3) $canSee = false; return $canSee; } forum::canView function below public function canView($id, $rank) { //extract forum details $forum = $this->database->processQuery("SELECT `type` FROM `forums` WHERE `id` = ? LIMIT 1", array($id), true); return ((($forum[0]['type'] == 4 && $rank < 3) || ($forum[0]['type'] == 5 && $rank < 4)) || $this->database->getRowCount() == 0 || ($forum[0]['type'] == 6 && !isset($_COOKIE['user']))) ? false : true; } The next error is when you reply to a thread. It comes up with the following error but it still sends the reply. Strict Standards: Declaration of thread::canView() should be compatible with forum::canView($id, $rank) in /home/connorb/public_html/06kayos/forums/reply.php on line 6 Warning: Cannot modify header information - headers already sent by (output started at /home/connorb/public_html/06kayos/forums/reply.php:6) in /home/connorb/public_html/06kayos/structure/base.phpon line 66 Thank you for any help! Edited September 2, 2014 by c0nnr Quote Link to comment https://forums.phpfreaks.com/topic/290801-uh-oh-strict-standards/ Share on other sites More sharing options...
requinix Posted September 2, 2014 Share Posted September 2, 2014 For thread::canView to be compatible with forum::canView it must take two arguments - like its parent does. With a couple exceptions, but none of those include adding a third required parameter. $powerLevel is a property of the thread, right? Since this method is inside the thread code, you should not take $powerLevel as an argument but instead get that from the thread's data (whatever and wherever that may be) automatically. Quote Link to comment https://forums.phpfreaks.com/topic/290801-uh-oh-strict-standards/#findComment-1489645 Share on other sites More sharing options...
Jacques1 Posted September 2, 2014 Share Posted September 2, 2014 PHP doesn't like it when you override a method with different parameters in a subclass. Quote Link to comment https://forums.phpfreaks.com/topic/290801-uh-oh-strict-standards/#findComment-1489646 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.