View Issue Details

IDProjectCategoryView StatusLast Update
0020365mantisbtdb mysqlpublic2016-06-12 00:43
Reporterdregad Assigned 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
<pre>
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;
}
</pre>

dregad

dregad

2015-12-09 03:03

developer   ~0052081

Last edited: 2015-12-09 03:03

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

<pre>
$t_result = db_query( 'SHOW TABLE STATUS' );
while( $t_row = db_fetch_array( $t_result ) ) {</pre>

and db_fetch_array() is returning the first row like this

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

and the subsequent ones like this

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

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 13:32

dregad


Details Diff
Update ADOdb library to 5.20.2

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

MantisBT: master b5c53a31

2015-12-26 13:39

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
Affected Issues
0020365
mod - admin/check/check_database_inc.php Diff File
mod - core/constant_inc.php Diff File