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

Bug #18398 non-static functions called statically
Submitted: 2011-03-25 01:03 UTC Modified: 2012-03-22 15:32 UTC
From: cdjohnk Assigned: danielc
Status: Closed Package: MDB2 (version 2.5.0b3)
PHP Version: 5.3.5 OS: OS X
Roadmaps: 2.5.0b4    
Subscription  


 [2011-03-25 01:03 UTC] cdjohnk (Chris Johnk)
Description: ------------ I'm getting the following error in php 5.3: DATE: 3/24/11 16:31:32 ERROR NUMBER: 2048 ERROR: Non-static method MDB2::raiseError() should not be called statically FILE: /usr/lib/php/MDB2.php:340 The DSN in the attached is purposely bogus to try to trigger raiseError(). raiseError() is not getting called because it's not declared static. Adding ~E_STRICT to error_reporting in php.ini did not help. Test script: --------------- require_once("MDB2.php"); $dsn = array( 'phptype' => 'x', 'hostspec' => 'x', 'database' => 'x', 'username' => 'x', 'password' => 'x' ); $db = new MDB2(); $dbh = $db->connect($dsn); Expected result: ---------------- The appropriate error message generated by raiseError in response to the bogus DSN. Actual result: -------------- DATE: 3/24/11 16:31:32 ERROR NUMBER: 2048 ERROR: Non-static method MDB2::raiseError() should not be called statically FILE: /usr/lib/php/MDB2.php:340

Comments

 [2012-01-19 09:08 UTC] alec (Aleksander Machniak)
Why this is still not fixed? I think the fix is as simple as adding "static" keyword to the method definition.
 [2012-01-30 23:57 UTC] drizzle (Needed Why)
Seriously, I think this package needs a new maintainer. One of the many reasons why PHP is the joke of the programming world. Something as simple as a database abstraction layer goes dead for years...
 [2012-01-31 02:41 UTC] danielc (Daniel Convissor)
-Status: Open +Status: Verified -Roadmap Versions: +Roadmap Versions: 2.6
Ladies and Gentlemen: PEAR and MDB2 are not E_STRICT compliant. Marking MDB2::raiseError() static just moves the error up the chain to PEAR::raiseError() not being static. Changing this situation will take some thought. The reason you're seeing this is you are using a custom error handler. Error handlers ignore what's set in error_reporting. If you want to see strict errors, adjust your error handler to return without doing anything if the error level is E_STRICT.
 [2012-01-31 02:57 UTC] danielc (Daniel Convissor)
Note for MDB2 developers: a test has been added to BugsTest.php and marked as skipped.
 [2012-03-22 15:32 UTC] danielc (Daniel Convissor)
-Status: Verified +Status: Closed -Assigned To: +Assigned To: danielc -Roadmap Versions: 2.6 +Roadmap Versions:
Fixed in SVN. Will try to get a new beta released soon.