David Beroff (d4b) wrote,
David Beroff
d4b

Compatibility between PHP versions 4 and 5

So, I was trying to get to the heart of a message, "Non-static method Mail::factory() should not be called statically". Apparently this has caused intense squabbling, and many suggest to simply kill the messenger and suppress the message. Then there's a voice of reason, who actually comes out and says, "there's a reason why the warnings exist", and gently suggests the correct solution. I replaced
$smtp = Mail::factory('smtp', ...
with
$smtp = new Mail();
$response = $smtp->factory('smtp', ...
and the message correctly goes away.

Update: ...except this is wrong! :-(

On the other hand, the report of
8192: Assigning the return value of new by reference is deprecated in /usr/share/pear/Mail/smtp.php at 349
appears to be real, but is also outside of my control. I downloaded the PEAR::Mail source code, and, sure enough, line 349 of Mail/smtp.php has
$this->_smtp = &new Net_SMTP(...
The issue has now been reported several times over the past six years or so, and it sounds like it isn't being addressed so as to maintain compatibility with PHP 4. So, in this particular case, it sounds like the best route is to suppress the error. :-(
Tags: mtat, webdev
Subscribe
  • Post a new comment

    Error

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

    When you submit the form an invisible reCAPTCHA check will be performed.
    You must follow the Privacy Policy and Google Terms of use.
  • 0 comments