Jump to content

Uh oh, strict standards...


c0nnr

Recommended Posts

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:

 

418b89627897949e800d0d5356900095.png

 

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!
Link to comment
https://forums.phpfreaks.com/topic/290801-uh-oh-strict-standards/
Share on other sites

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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.