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

Bug #17858 BC break for MDB2::factory() method definition
Submitted: 2010-09-09 20:57 UTC
From: timj Assigned: quipo
Status: Wont fix Package: MDB2 (version 2.5.0b3)
PHP Version: 5.2.12 OS: Irrelevant
Roadmaps: 2.5.0b4    
Subscription  


 [2010-09-09 20:57 UTC] timj (Tim Jackson)
Description: ------------ In both the stable version of MDB (2.4.1) and in beta versions up to and including 2.5.0.b2, the factory method is defined in the PHP using a PHP4-compatible syntax, i.e.: function &factory($dsn, $options = false) MDB2-2.5.0b3 breaks backwards compatibility: if a derived class of MDB2 has declared an overloaded factory() method with a signature matching that in all previous versions of MDB2, this triggers a fatal error in MDB2-2.5.0b3: "Cannot make static method MDB2::factory() non static" Test script: --------------- <?php class myclass extends MDB2 { function &factory($dsn, $options = false) { // do something different to normal } } Expected result: ---------------- Works Actual result: -------------- Fatal error: Cannot make static method MDB2::factory() non static in class myclass in /path/to/myclass.php on line 3

Comments

 [2010-09-11 12:14 UTC] doconnor (Daniel O'Connor)
-Status: Open +Status: Verified
 [2010-09-11 12:22 UTC] quipo (Lorenzo Alberton)
-Status: Verified +Status: Wont fix -Assigned To: +Assigned To: quipo
Sorry, as explained on the mailing list, this change was inevitable to have STRICT compatibility with PHP 5.x. All the documentation and examples were declaring this method as static already, now we have a language construct to enforce it. Without the explicit "static" keyword, PHP 5 will complain.