PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » DB » Bug #227

Wrong Object handle with PHP5

Details

Submitted2003-11-12 08:58 UTC
Frommaxim at softsolutions dot de
StatusDuplicate
PackageDB
PHP Version5.0.0b1 (beta1)
OSSuSE Linux 9.0
Roadmaps(Not assigned)

Comments

[2003-11-12 08:58 UTC] maxim at softsolutions dot de

Description:
------------
we use DB for access to MySQL Database. One Problem is that PHP5 does not native support for MySQL. Other Problem is object handle in common.php. Execute a query on Query-function have error: only variable can return by reference value.

Reproduce code:
---------------
// do the db connect
$m_idDB = DB::connect( $szDsn, $p_bPersistant );
$result = $m_idDB->Select("Select * from CLASS");

function &query($query, $params = array()) {
if (sizeof($params) > 0) {
$sth = $this->prepare($query);
if (DB::isError($sth)) {
return $sth;
}
$ret = $this->execute($sth, $params);
$this->freePrepared($sth);
return $ret;
} else {
$result = $this->simpleQuery($query);
if (DB::isError($result) || $result === DB_OK) {
return $result;
} else {
return new DB_result($this, $result);
}
}
}

when i change this function to
function &query($query, $params = array(...
than it works!!!!!!!!!