php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40244 PHP Strict errors even with E_STRICT Disabled
Submitted: 2007-01-26 01:11 UTC Modified: 2007-01-26 15:56 UTC
From: lists at cyberlot dot net Assigned:
Status: Not a bug Package: Compile Warning
PHP Version: 5.2.0 OS: Centos 4.4
Private report: No CVE-ID:
 [2007-01-26 01:11 UTC] lists at cyberlot dot net
Description:
------------
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



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);

?>

Reproduce code:
---------------
<?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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-26 01:26 UTC] lists at cyberlot dot net
Happens in the newest RC4 release as well
 [2007-01-26 01:27 UTC] lists at cyberlot dot net
also if you remove the error_reporting($er); the error goes away, even though that line is after all the other php code.
 [2007-01-26 09:00 UTC] tony2001@php.net
Please report PEAR issues to PEAR people using PEAR bug tracker: http://pear.php.net
Thank you.
 [2007-01-26 15:04 UTC] lists at cyberlot dot net
They told me to report it to you

http://pear.php.net/bugs/bug.php?id=9950

So the 2 "teams" need to get together and figure this out one way or the other.

Since this has to do directly with error reporting not disabling warnings, not with the fact that there are warnings I would tend to lean towards the php side of things
 [2007-01-26 15:11 UTC] tony2001@php.net
These messages are generated in compile time, all the functions are executed AFTER that, so error_reporting(0); does not have any effect and this is expected behaviour.

 [2007-01-26 15:23 UTC] lists at cyberlot dot net
Your wrong, Try the following

<?php

$er = error_reporting(0);
include('Mail.php');

$mail_object = Mail::factory('smtp');
$mail_object->send('test@test.com','Subject','Body');


?>

If these errors are during compile time, and compile time happens before all this then why does the above code not report the errors?
 [2007-01-26 15:23 UTC] tony2001@php.net
I was wrong, these PEAR classes register some shutdown function, which generates those warnings and the second call to error_reporting() enables them.
Still pretty much expected.
 [2007-01-26 15:56 UTC] lists at cyberlot dot net
Thank you Tony for taking some time to look into this, whats happening makes a lot more sense now.
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Thu Apr 24 21:01:55 2014 UTC