View Issue Details

IDProjectCategoryView StatusLast Update
0020365mantisbtdb mysqlpublic2016-06-12 00:43
ReporterdregadAssigned Todregad 
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version1.3.0-rc.1 
Target Version1.3.0-rc.2Fixed in Version1.3.0-rc.2 
Summary0020365: SYSTEM NOTICE: Undefined index with mysqli driver
Description

The issue was initially reported by atrol in 0020357

When running admin checks with Verbose messges turned on, the page displays errors like:

SYSTEM NOTICE: Undefined index: comment
Raised in file /srv/www/bugs/admin/check/check_database_inc.php on line 382
SYSTEM NOTICE: Undefined index: name
Raised in file /srv/www/bugs/admin/check/check_database_inc.php on line 383

TagsNo tags attached.

Relationships

related to 0020357 closeddregad Admin checks for UTF-8 collation fail 
parent of 0020467 closeddregad Update ADOdb to 5.20.2 

Activities

dregad

dregad

2015-12-08 11:25

developer   ~0052077

I have the impression that this is an issue with the underlying ADOdb library - need to test.

It seems that the recordset's fields' case is not properly set to lowercase as it should:

In check_database_inc.php, the following query is executed: 'SHOW TABLE STATUS'.
The first fetched record - via db_fetch_array() - has lowercase field names, as expected (e.g. 'name').
Subsequent records have the first char of the field in uppercase ('Name')

atrol

atrol

2015-12-08 11:34

developer   ~0052079

Just want to be sure that you did notice also this special treatment in check_database_inc.php

    switch( $g_db_type ) {
        case 'mysql':
            $t_field_name      = 'Name';
            $t_field_comment   = 'Comment';
            $t_field_collation = 'Collation';
            $t_field_field     = 'Field';
            $t_field_type      = 'Type';
            break;
        case 'mysqli':
            $t_field_name      = 'name';
            $t_field_comment   = 'comment';
            $t_field_collation = 'collation';
            $t_field_field     = 'field';
            $t_field_type      = 'type';
            break;
    }
dregad

dregad

2015-12-09 03:03

developer   ~0052081

Last edited: 2015-12-09 03:03

View 2 revisions

Thanks, I know about that one. The problem is that these variables are used as index for the rows being retrieved further down,

    $t_result = db_query( 'SHOW TABLE STATUS' );
    while( $t_row = db_fetch_array( $t_result ) ) {

and db_fetch_array() is returning the first row like this

Array
(
    [name] => mantis_api_token_table
    [engine] => InnoDB
    [version] => 10
    ...

and the subsequent ones like this

Array
(
    [Name] => mantis_bug_file_table
    [Engine] => MyISAM
    [Version] => 10
    ...

It looks like the ADOdb ADORecordSet::MoveNext() method is not properly handling the field names' case in associative fetch mode.

This issue also exists with ADOdb 5.19. Further research is needed, but I don't have time to do it now.

dregad

dregad

2015-12-09 04:53

developer   ~0052084

Confirmed ADOdb issue https://github.com/ADOdb/ADOdb/issues/167.

The problem is not as critical as I thought initially, because in our case it only affects queries on the MySQL information_schema. Mantis schema queries are not affected, because all our column names are in lowercase.

dregad

dregad

2015-12-20 19:18

developer   ~0052149

ADOdb 5.20.2 which includes the required fix is expected to be released next week.

Related Changesets

MantisBT: master 0b972949

2015-12-26 18:32:47

dregad

Details Diff
Update ADOdb library to 5.20.2

This is a prerequisite to fix issue 0020365.
mod - library/README.md Diff File
mod - library/adodb Diff File

MantisBT: master b5c53a31

2015-12-26 18:39:04

dregad

Details Diff
Admin check: fix system notice with mysql drivers

With ADOdb 5.20.2, the mysql and mysqli drivers properly handle
associative fetch mode case, and consistently return lowercase column
names as per ADODB_ASSOC_CASE setting in database API.

We therefore no longer need to differentiate processing between the 2
drivers.

Minimum ADOdb version has been bumped accordingly.

Fixes 0020365
mod - admin/check/check_database_inc.php Diff File
mod - core/constant_inc.php Diff File

Issue History

Date Modified Username Field Change
2015-12-08 11:18 dregad New Issue
2015-12-08 11:18 dregad Issue generated from: 0020357
2015-12-08 11:25 dregad Note Added: 0052077
2015-12-08 11:34 atrol Note Added: 0052079
2015-12-09 03:03 dregad Note Added: 0052081
2015-12-09 03:03 dregad Note Edited: 0052081 View Revisions
2015-12-09 04:53 dregad Status new => confirmed
2015-12-09 04:53 dregad Note Added: 0052084
2015-12-20 19:18 dregad Assigned To => dregad
2015-12-20 19:18 dregad Status confirmed => assigned
2015-12-20 19:18 dregad Note Added: 0052149
2015-12-29 12:26 dregad Relationship added related to 0020357
2016-01-01 18:56 dregad Changeset attached => MantisBT master 0b972949
2016-01-01 18:56 dregad Changeset attached => MantisBT master b5c53a31
2016-01-01 18:56 dregad Status assigned => resolved
2016-01-01 18:56 dregad Resolution open => fixed
2016-01-01 18:56 dregad Fixed in Version => 1.3.0-rc.2
2016-01-01 19:02 dregad Relationship added parent of 0020467
2016-06-12 00:43 vboctor Status resolved => closed