Bug #16519 [Opn]: Options in DB_DataObject not passed in MDB2 if used as Driver

From: Date: Sun, 27 Sep 2009 10:00:23 +0000
Subject: Bug #16519 [Opn]: Options in DB_DataObject not passed in MDB2 if used as Driver
References: 1  Groups: php.pear.bugs 
Request: Send a blank email to pear-bugs+get-1741@lists.php.net to get a copy of this message
Edit report at http://pear.php.net/bugs/bug.php?id=16519&edit=1 ID: 16519 Updated by: l.alberton@quipo.it Reported By: jerome dot auza at mfgvision dot com Summary: Options in DB_DataObject not passed in MDB2 if used as Driver Status: Open Type: Bug -Package: MDB2 +Package: DB_DataObject Operating System: Linux Package Version: 2.4.1 PHP Version: 5.2.5 Roadmap Versions: New Comment: -Package: MDB2 +Package: DB_DataObject Previous Comments: ------------------------------------------------------------------------ [2009-08-13 10:39:39] jjauza Description: ------------ Options specifed in DB_DataObject are not passed to MDB2 object if MDB2 is used as Driver. A fix I used on my code to get this working is the following although I'm not sure if this is the right way to do it: in MDB2.php, near line 4295 : function &getDBInstance() { if (isset($GLOBALS['_MDB2_databases'][$this->db_index])) { $result =& $GLOBALS['_MDB2_databases'][$this->db_index]; // Fix for DB_DATAOBJECT options not passed to MDB2 foreach($GLOBALS['_DB_DATAOBJECT']['CONFIG'] as $key=>$value) { $result->options[$key]=$value; } // end of fix } else { $result =& MDB2::raiseError(MDB2_ERROR_NOT_FOUND, null, null, 'could not find MDB2 instance'); } return $result; } Test script: --------------- <?php include_once("MDB2.php"); include_once("DB/DataObject.php"); $options = &PEAR::getStaticProperty('DB_DataObject','options'); $options = array( 'database' => DSN_TO_YOUR_DB, 'class_prefix' => 'DataObjects_', 'proxy' => 'full', 'field_case' => CASE_UPPER, 'portability' => MDB2_PORTABILITY_ALL, 'debug' => 5, 'db_driver' => 'MDB2', ); $tbl = DB_DataObject::factory('table_name'); print_r($GLOBALS['_MDB2_databases']); print_r($GLOBALS['_DB_DATAOBJECT']['CONFIG']); Expected result: ---------------- the array values in $GLOBALS['_DB_DATAOBJECT']['CONFIG'] should be found in the options array in $GLOBALS['_MDB2_databases'] Actual result: -------------- The options field $GLOBALS['_MDB2_databases'] seem to be just default option values.and none of the options specified in the sample code are passed. ------------------------------------------------------------------------ -- Edit this bug report at http://pear.php.net/bugs/bug.php?id=16519&edit=1

« previous php.pear.bugs (#1741) next »