Opened 6 years ago
Closed 6 years ago
#1484280 closed Bugs (fixed)
Call to a member function fetchRow() on a non-object
| Reported by: | moc | Owned by: | |
|---|---|---|---|
| Priority: | 5 | Milestone: | 0.1-rc1 |
| Component: | PHP backend | Version: | git-master |
| Severity: | normal | Keywords: | |
| Cc: |
Description
In the rcube_db.inc file the functions fetch_assoc() and fetch_array() are not written correctly. It generates errors in the log if the $result is not a resource.
Here is a patch for it:
function fetch_assoc($res_id=NULL)
{
if ($result = $this->_get_result($res_id))
return $this->_fetch_row($result, DB_FETCHMODE_ASSOC);
else
return FALSE;
}
function fetch_array($res_id=NULL)
{
if ($result = $this->_get_result($res_id))
return $this->_fetch_row($result, DB_FETCHMODE_ORDERED);
else
return FALSE;
}
Change History (5)
comment:1 Changed 6 years ago by thomasb
- Resolution set to fixed
- Status changed from new to closed
comment:2 Changed 6 years ago by moc
- Resolution fixed deleted
- Status changed from closed to reopened
- Type changed from Patches to Bugs
- Version changed from 0.1-beta to svn-trunk
The problem still exists. I have the same errors in my log. Investigating I have found that sometimes the $result parameter passed to the _fetch_row() function is an integer. I suggest to change the line 363 of rcube_db.inc file:
if (!$result || !is_object($result) || DB::isError($result))
comment:3 Changed 6 years ago by fourat.zouari
- Resolution set to fixed
- Status changed from reopened to closed
Fixed in Trunk ([516])
comment:4 Changed 6 years ago by moc
- Resolution fixed deleted
- Status changed from closed to reopened
now in my error log I have the following message:
PHP Fatal error: Call to a member function getMessage() on a non-object in /usr/local/www/orodjarnica/roundcubemail/program/include/rcube_db.inc on line 365
Maybe we should write:
function _fetch_row($result, $mode)
{
if(!$result || DB::isError($result))
{
raise_error(array('code' => 500, 'type' => 'db', 'line' => __LINE__, 'file' => __FILE__,
'message' => $this->db_link->getMessage()), TRUE, FALSE);
return FALSE;
}
else if (!is_object($result))
return FALSE;
return $result->fetchRow($mode);
}
comment:5 Changed 6 years ago by fourat.zouari
- Resolution set to fixed
- Status changed from reopened to closed
Fixed in [518]
Thanks for debugging and helping
Note: See
TracTickets for help on using
tickets.

Fixed in Trunk ([e6c7c3ca])