Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.0.0

Bug #9950 PHP Strict errors even with E_STRICT Disabled
Submitted: 2007-01-25 21:37 UTC
From: lists at cyberlot dot net Assigned:
Status: Bogus Package: Mail
PHP Version: 5.2.0 OS: Centos
Roadmaps: (Not assigned)    
Subscription  


 [2007-01-25 21:37 UTC] lists at cyberlot dot net (Richard THomas)
Description: ------------ This is during the user of Net_SMTP and Mail but the bugs come from the user of is_a in PEAR And non-static method calls to PEAR::isError() error_reporting(0) not working as expected within pear Really not to sure as to the best way to classify it so put it as a pear bug since the errors are mostly from pear Test script: --------------- <?php $er = error_reporting(0); include('Mail.php'); $mail_object = Mail::factory('smtp'); $mail_object->send('test@test.com','Subject','Body'); error_reporting($er); ?> Expected result: ---------------- Nothing error reporting is turned off before code, turned back on after code Actual result: -------------- PHP Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/local/lib/php/Net/SMTP.php on line 331 PHP Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/local/lib/php/Net/SMTP.php on line 169 PHP Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/local/lib/php/PEAR.php on line 281 PHP Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/local/lib/php/PEAR.php on line 281 PHP Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/local/lib/php/Net/SMTP.php on line 334 PHP Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/local/lib/php/PEAR.php on line 281 PHP Strict Standards: Non-static method PEAR::isError() should not be called statically, assuming $this from incompatible context in /usr/local/lib/php/Net/SMTP.php on line 337 PHP Strict Standards: is_a(): Deprecated. Please use the instanceof operator in /usr/local/lib/php/PEAR.php on line 281

Comments

 [2007-01-25 22:22 UTC] cellog (Greg Beaver)
this is a PHP bug, not a PEAR bug.
 [2007-01-26 15:04 UTC] lists at cyberlot dot net
They told me to report it to you http://bugs.php.net/bug.php?id=40244 So the 2 "teams" need to get together and figure this out one way or the other
 [2007-01-26 23:49 UTC] cellog (Greg Beaver)
assigning to the package that is being used (Mail.php is not the PEAR package)
 [2007-01-27 00:53 UTC] chagenbu at php dot net (Chuck Hagenbuch)
There's no way this is Mail's fault.
 [2009-01-26 19:43 UTC] tonyv (Tony VanderHoff)
So, here is a two-year old bug that seems neither resolved by PHP nor PEAR teams, with each blaming the other. Not really interested in the politics, but I'd like to get my scripts working under PHP5. I'm calling Mail::factory(), in accordance with the documentation, and this works fine under PHP4. Now, under PHP5, I'm getting the dreaded "Non-static Method....", despite the comment in the docs that it *should* be called statically. I've tried setting up a call $m=new Mail(); $smtp=$m->factory( 'smtp' ); That fails with "Assigning the return value of new by reference is deprecated at line 210 in /usr/share/php/Mail/smtp.php" Any messing with error_reporting(0) appears to make no difference as observed in this bug report. Please, someone, how am I supposed to set this up?
 [2009-11-13 19:15 UTC] qtx (Ihor Maskov)
Well, it is really pity. But it looks like that the developer of the Mail package does not understand what are static methods. He calls many times in his code PEAR::isError although the method isError is not static. He declares the method parseAddressList of the class Mail_RFC822 as normal but tries to call it statically in Mail.php. The developer of the Mail should correct this in the Mail package. Neither PHP nore PEAR are responsible for this bug.
 [2009-11-13 19:24 UTC] cweiske (Christian Weiske)
> But it looks like that the developer of the Mail package does not > understand what are static methods. You don't understand PHP4 compatibility.
 [2009-11-13 19:33 UTC] qtx (Ihor Maskov)
In the line 161 of the file Mail.php, the is a call $parser = new Mail_RFC822(); $addresses = $parser->parseAddressList($value, 'localhost', false); It is correct. But in the line 228 $addresses = Mail_RFC822::parseAddressList($value, 'localhost', false); It produces warnings. I corrected it like the first example, now it works.
 [2010-06-29 14:00 UTC] amcnaughton (Andrew McNaughton)
There seems to be some confusion here. This bug report is not about the issues which the warnings are about. It is about those warnings being generated despite error_reporting() being set to a level where those errors should not be reported.
 [2010-10-02 00:09 UTC] recurse (Kenshi Holmes)
Any updates on this issues? I'm having the same problem. E_STRICT is *disabled* and I'm still getting the error described.
 [2010-11-22 21:34 UTC] clee (chris lee)
Again, I'd like to echo other people here. I've disabled all error reporting, and yet the script is still failing out on the mentioned issues. Any workarounds?
 [2011-02-11 03:40 UTC] julisana (Lisa Riggle)
Yep, I'm having the same issue. All error reporting is disabled and yet I still get a page full of PHP Strict Standards when I try and use PEAR's Mail package.
 [2011-03-15 17:29 UTC] hanjukim (Hanju Kim)
Check your error_reporting AND set_error_handler. set_error_handler function has E_ALL | E_STRICT as second parameter.
 [2011-04-05 14:25 UTC] erwin_moller (Erwin Moller)
For those tired of this situation, like me, have a look at phpmailer. It actually works, and I switched to it. http://phpmailer.worxware.com/ PHPmailer = GNU LESSER GENERAL PUBLIC LICENSE
 [2012-10-20 23:02 UTC] matteosistisette (matteo sisti sette)
Fucking ridiculous. 5 years!
 [2012-11-27 23:46 UTC] cfturkja (Jari Turkia)
matteosistisette: You said it! Well done guys & gals. You're surely making a nice example of open-source _NOT_ working at all. Sure, I got the source. Sure I got to do the fixes myself. And sure, authors of none of the packages are interested. Way to go! Keep up your lousy work!
 [2012-11-28 13:45 UTC] erwin_moller (Erwin Moller)
That are very harsh words, Jari Turkia. I understand your frustration. But always remember this: PEAR is offered for free, so is the MAIL package. It seems support is dropped for PEAR/MAIL, or our complaint is ignored for other reasons. Whatever the reason: if you want the MAIL package to improve, you can start helping yourself. You must ALWAYS remember you sound like a spoiled kid when you DEMAND more support for free, only because you received the software for free in the past. Bottom-line: People developed this in their own time (in most cases) and gave it to the community for free. You cannot demand anything. If you want it improved, you can do it yourself and share your results with the community, like the authors did... That aside: I share you frustration, and PEAR/MAIL isn't easily fixed because of all the dependencies. If you want to fix it yourself you must first become a PEAR expert. If you want a solution that works out of the box, have a look at phpmailer I posted 3 postings back. Regards, Erwin Moller
 [2012-12-13 19:17 UTC] patri_ferrnandez (Patricia Fernández)
I'm having the same problem and i not using the Mail package. Apache errors log: PHP Strict Standards: Non-static method PEAR::setErrorHandling() should not be called statically. Anyone has solved this problem? Thanks in advance.
 [2012-12-13 19:32 UTC] patri_ferrnandez (Patricia Fernández)
Never mind. I've solved my issue writing static word in function setErrorHandling, inside Pear.php. Regards
 [2012-12-19 00:17 UTC] nd4c (Jeff Jones)
I'm not sure I understand the logic behind cellog's comment: this is a PHP bug, not a PEAR bug. Doesn't PEAR run on PHP? So isn't it supposed to run correctly on any standard PHP platform? I don't think I've ever met a PHP programmer that, when an error pops up, thought PHP should change and not their program. (Well, OK, we all blame PHP, but in the end we realize that the responsibility is on the app developer not the platform developer.)
 [2012-12-29 20:49 UTC] sarah (Sarah Meier)
I've the same problem. Please fix it.
 [2015-02-21 16:11 UTC] omarabid (Abid Omar)
So 8 years later and this is still not solved?
 [2015-02-21 18:29 UTC] cweiske (Christian Weiske)
The reason for the appearance of the E_STRICT errors despite error_reporting(0) is that you actually do reset the error reporting level at the end of the script. This enables showing of E_STRICT warnings again, and the Mail_smtp destructor is called *after* this. So the errors are shown again. The destructor is registered via "register_shutdown_function()". Mail_smtp does then call Net_SMTP::disconnect() which in turn does the PEAR::isError() calls. You can circumvent this by calling Mail_smtp->disconnect() before resetting the error reporting level: $mail_object->disconnect(); error_reporting($er);
 [2015-02-21 18:30 UTC] cweiske (Christian Weiske)
And we are actually working on a new pear version (1.10.0) that fixes the static warnings - see bug #20488.