View Issue Details

IDProjectCategoryView StatusLast Update
0013438mantisbtdb oraclepublic2015-03-16 19:24
Reporterdregad 
Assigned Todregad 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.2.9 
Target Version1.3.0-beta.1Fixed in Version1.3.0-beta.1 
Summary0013438: adodb: Fatal error: Call to a member function FetchRow() on a non-object
Description

When generating the SQL script for Oracle DB, the following error occurs

Fatal error: Call to a member function FetchRow() on a non-object in /xxx/mantisbt/library/adodb/drivers/adodb-oci8.inc.php on line 368

Call Stack:
0.0018 574752 1. {main}() /xxx/mantisbt/admin/install.php:0
0.3886 12819936 2. call_user_func_array() /xxx/mantisbt/admin/install.php:719
0.3886 12820252 3. db_index_exists() /xxx/mantisbt/admin/install.php:719
0.3888 12820296 4. ADODB_oci8->MetaIndexes() /xxx/mantisbt/core/database_api.php:645

Steps To Reproduce

Fresh install of Mantis, run install.php
In options, set

  • DB=Oracle (settings as appropriate)
  • Check "Print SQL Queries instead of Writing to the Database"
Additional Information

I believe this is due to an error in ADOdb, which does not cover the case where no constraints are defined for an index.

        // get Primary index
        $primary_key = '';

        $false = false;
        $rs = $this->Execute(sprintf("SELECT * FROM ALL_CONSTRAINTS WHERE UPPER(TABLE_NAME)='%s' AND CONSTRAINT_TYPE='P'",$table));
// ==> FAILS HERE IF QUERY RETURNS NO DATA ($rs == false)
        if ($row = $rs->FetchRow())
           $primary_key = $row[1]; //constraint_name
Tagspatch

Relationships

parent of 0013433 closeddregad Error ORA-00904: "PROTECTED": invalid identifier for the query 
parent of 0007644 closeddregad Problems when creating the Mantis database schema on Oracle 
child of 0013713 closeddregad Upgrade ADOdb library to latest version 

Activities

dregad

dregad

2011-10-24 08:54

developer  

adodb-fix-13438.patch (630 bytes)
diff --git a/library/adodb/drivers/adodb-oci8.inc.php b/library/adodb/drivers/adodb-oci8.inc.php
index 0d69b75..ad69860 100644
--- a/library/adodb/drivers/adodb-oci8.inc.php
+++ b/library/adodb/drivers/adodb-oci8.inc.php
@@ -364,6 +364,14 @@ NATSOFT.DOMAIN =
 
 		$false = false;
 		$rs = $this->Execute(sprintf("SELECT * FROM ALL_CONSTRAINTS WHERE UPPER(TABLE_NAME)='%s' AND CONSTRAINT_TYPE='P'",$table));
+
+		if (!is_object($rs)) {
+			if (isset($savem))
+				$this->SetFetchMode($savem);
+			$ADODB_FETCH_MODE = $save;
+			return $false;
+		}
+
 		if ($row = $rs->FetchRow())
 		   $primary_key = $row[1]; //constraint_name
 
adodb-fix-13438.patch (630 bytes)
dregad

dregad

2011-10-24 08:55

developer   ~0030044

Upstream bug report http://phplens.com/lens/lensforum/msgs.php?id=19001

dregad

dregad

2011-10-25 13:24

developer   ~0030070

This patch is included in the latest version of oracle branch, see https://github.com/dregad/mantisbt/commit/515d381cc708199ca369c4ba9266ea3dc9aab5a7

dregad

dregad

2011-10-27 10:09

developer   ~0030086

Feedback from upstream:

Topic: Re:oci8 MetaIndex function
author: John Lim created: 27-10-2011 02:19:01 AM
Looks good. Thanks i will add it to the next version of adodb.

dregad

dregad

2012-03-30 04:09

developer   ~0031569

2 releases of adodb have gone by, but the author still has not included the patch.

dregad

dregad

2012-05-14 11:19

developer   ~0031833

Received an e-mail from John Lim (adodb author) who said this fix will be included in 5.17

dregad

dregad

2012-05-25 06:54

developer   ~0031902

Bug has been fixed upstream in AdoDB version 5.17.

Related Changesets

MantisBT: master 8792ee55

2011-10-24 11:41:22

dregad

Details Diff
DB ADOdb MetaIndex fails when no constraints exist

Working with Oracle database (oci8), when MetaIndex() method is called
to retrieve the list of indexes for a table that has no constraints
set, an error is triggered:
Fatal error: Call to a member function FetchRow() on a non-object

This commit adds a check to cleanly exit the function, returning false.

Similar error handling has also been added to the calling database_api
function db_index_exists()

This allows the DB installation (schema.php) to proceed without errors.

Fixes 0013438

Porting to 1.3 - Conflicts:
library/adodb/drivers/adodb-oci8.inc.php

Note: the fix to ADOdb driver does not need to be ported as it was
included in a later release of the library.
mod - core/database_api.php Diff File

Issue History

Date Modified Username Field Change
2011-10-24 08:50 dregad New Issue
2011-10-24 08:54 dregad File Added: adodb-fix-13438.patch
2011-10-24 08:54 dregad Tag Attached: patch
2011-10-24 08:55 dregad Note Added: 0030044
2011-10-24 08:56 dregad Relationship added child of 0013433
2011-10-24 08:56 dregad Relationship added child of 0007644
2011-10-25 13:24 dregad Note Added: 0030070
2011-10-25 13:24 dregad Assigned To => dregad
2011-10-25 13:24 dregad Status new => confirmed
2011-10-27 10:09 dregad Note Added: 0030086
2012-03-30 04:09 dregad Note Added: 0031569
2012-05-14 11:19 dregad Note Added: 0031833
2012-05-25 06:54 dregad Note Added: 0031902
2012-05-25 06:58 dregad Relationship added related to 0013713
2012-05-25 07:01 dregad Relationship replaced child of 0013713
2013-10-17 12:08 dregad Changeset attached => MantisBT master 8792ee55
2013-10-17 12:08 dregad Status confirmed => resolved
2013-10-17 12:08 dregad Resolution open => fixed
2013-10-17 12:08 dregad Fixed in Version => 1.3.0-beta.1
2013-10-17 12:54 dregad Target Version => 1.3.0-beta.1
2014-04-12 19:39 grangeway Issue cloned: 0017192
2014-12-08 00:34 vboctor Status resolved => closed
2015-03-16 19:24 dregad Relationship replaced parent of 0013433
2015-03-16 19:24 dregad Relationship replaced parent of 0007644