PHP Classes

Non-static method pop3_class::SetConnection()

Recommend this page to a friend!

      POP3 e-mail client  >  All threads  >  Non-static method...  >  (Un) Subscribe thread alerts  
Subject:Non-static method...
Summary:Non-static method pop3_class::SetConnection()
Messages:4
Author:Klemen
Date:2014-01-26 11:03:02
Update:2014-01-27 20:24:07
 

  1. Non-static method...   Reply   Report abuse  
Picture of Klemen Klemen - 2014-01-26 11:03:03
Hello,

When using this class in PHP strict mode
error_reporting(E_ALL | E_STRICT);

A strict standards error is generated:

PHP Strict Standards: Non-static method pop3_class::SetConnection() should not be called statically, assuming $this from incompatible context in /pop3.php on line 726

Line 726 reads:

$pop3 = &pop3_class::SetConnection(0, $host, $this->pop3);

I changed it to:

$pop3_class = new pop3_class();
$pop3 = $pop3_class->SetConnection(0, $host, $this->pop3);

Seems to work fine and suppresses the strict standards notice.

  2. Re: Non-static method...   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2014-01-27 10:57:51 - In reply to message 1 from Klemen
Well I am not getting any warnings but you may be using a newer PHP version. What version are you using?

Anyway, I have just updated the class now to avoid that problem.

  3. Re: Non-static method...   Reply   Report abuse  
Picture of Klemen Klemen - 2014-01-27 16:58:15 - In reply to message 2 from Manuel Lemos
I'm using PHP 5.5.8

Note that you must explicitly have E_STRICT enabled, it's not included in E_ALL (will be in PHP 6.0.0), for example:

error_reporting(E_ALL | E_STRICT);


Thanks for the prompt response and changes!

  4. Re: Non-static method...   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2014-01-27 20:24:07 - In reply to message 3 from Klemen
I see. I still testing it on 5.3. So I don't know what issues PHP 5.5 will bring up. Just let me know if the last update still brings any issues.