View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
371 | PHPOF2 | Default | public | 14 Sep 2010 12:19 | 7 Nov 2011 17:12 |
Reporter | timj | Assigned To | |||
Priority | normal | Severity | major | Reproducibility | always |
Status | new | Resolution | open | ||
Product Version | 0.12.1 | ||||
Summary | 371: Add compatibility with MDB2 2.5.0b3+ | ||||
Description | MDB2 2.5.0b3+ broke backwards compatibility :-( See http://pear.php.net/bugs/bug.php?id=17858 | ||||
Tags | No tags attached. | ||||
Attached Files | DB.php.bug371.patch (1,399 bytes)
Index: DB.php =================================================================== --- DB.php (revision 50448) +++ DB.php (working copy) @@ -27,7 +27,7 @@ require_once 'PHPOF2/DBTable.php'; -class PHPOF2_DB extends MDB2 { +abstract class PHPOF2_DB_Abstract extends MDB2 { const LOB_PLACEHOLDER = '!lob-data-present!'; const LOB_DELETEPENDING = '!lob-delete-pending!'; @@ -63,7 +63,7 @@ * @param array $options Options to pass; can include any standard MDB2 options plus additional PHPOF2 ones (see the full documentation for this method) * @return MDB2 */ - function &factory($dsn, $options = false) + static function factoryInstance($dsn, $options = false) { // Options that are specific to PHPOF2_DB and are not to be passed to MDB2 // (MDB2 throws errors if it gets options it doesn't know about) @@ -135,4 +135,28 @@ } return $mdb2; } + + public static function getApiVersion() + { + return self::apiVersion(); + } } + +if (version_compare(PHPOF2_DB_Abstract::getApiVersion(), '2.5.0b3', '>=')) { + class PHPOF2_DB extends PHPOF2_DB_Abstract + { + static function factory($dsn, $options=false) + { + return self::factoryInstance($dsn, $options); + } + } +} else { + class PHPOF2_DB extends PHPOF2_DB_Abstract + { + function &factory($dsn, $options=false) + { + $instance = self::factoryInstance($dsn, $options); + return $instance; + } + } +} | ||||
|
Hi Tim, From the comments on the pear bug it there wll not be any resolution. So I have put in place attached a possible fix, it is hacky but it is the cleanest solution for this situation that I could think of. |
|
That's a really clever hack :-) |
Date Modified | Username | Field | Change |
---|---|---|---|
14 Sep 2010 12:19 | timj | New Issue | |
7 Nov 2011 12:07 | mrosenquist | File Added: DB.php.bug371.patch | |
7 Nov 2011 12:11 | mrosenquist | Note Added: 406 | |
7 Nov 2011 17:12 | timj | Note Added: 407 |