View Issue Details

IDProjectCategoryView StatusLast Update
0020074mantisbtdb mssqlpublic2016-01-25 16:21
Reporteralex.volkovAssigned Todregad 
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
PlatformMicrosoftOSWindows Server 2012 R2OS Version
Product Version1.3.0-beta.2 
Target VersionFixed in Version1.3.0-rc.1 
Summary0020074: ADODB_FETCH_MODE global is not properly set by database_api.php
Description

database_api.php attempts to set ADODB_FETCH_MODE global (from adodb.inc.php) to ADODB_FETCH_ASSOC. But because require_lib() function is used to bring in the adodb.inc.php, the ADODB_FETCH_MODE is not brought in as a global into the scope. database_api.php does not declare ADODB_FETCH_MODE as a global either. This results in the following line creating a new ADODB_FETCH_MODE variable in the scope:
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;

The ultimate result is ADODB using the ADODB_FETCH_DEFAULT mode (0), which for mssqlnative driver appears to be ADODB_FETCH_NUM.

The var should be declared global in database_api.php:
global $ADODB_FETCH_MODE;
or changed to:
$GLOBALS['ADODB_FETCH_MODE'] = ADODB_FETCH_ASSOC;

Additional Information

MS Windows Server 2012 R2 / IIS v8.5
MS SQL Server 2012
PHP 5.6.12 x86, FastCGI, php-cgi.exe
MS Driver for SQL Server v3.2 x86, NTS, php_sqlsrv_56_nts.dll
mssqlnative ADODB driver: cachedSchemaFlush patched

Here is the failed trace:

ADODB_Setup() called
$ADODB_FETCH_MODE in ADODB_Setup(): 0
SYSTEM NOTICE: 'Undefined variable: ADODB_FETCH_MODE' in 'D:\Websites\Mantis\core\database_api.php' line 59
$ADODB_FETCH_MODE in database_api:
$GLOBALS['ADODB_FETCH_MODE'] in database_api: 0
(var set here)
$ADODB_FETCH_MODE in database_api: 2
$GLOBALS['ADODB_FETCH_MODE'] in database_api: 0

TagsNo tags attached.

Activities

dregad

dregad

2015-09-06 05:59

developer   ~0051381

Thanks for the detailed bug report.

dregad

dregad

2016-01-12 06:17

developer   ~0052296

I had already identified this issue in my ADOdb update branch, back in May 2015.

This was actually fixed in 1.3.0-rc.1 (v:mantisbt:f0c3959bfe3522eee6ebc7078405e23628f60c6d:)

Related Changesets

MantisBT: master f0c3959b

2015-05-17 03:59:31

dregad

Details Diff
Database API now properly sets ADOdb fetch mode

Prior to this, the lack of global indicator for $ADODB_FETCH_MODE caused
the driver to load with default setting, since the variable was
initialized outside of its scope.
mod - core/database_api.php Diff File

Issue History

Date Modified Username Field Change
2015-09-03 19:08 alex.volkov New Issue
2015-09-06 05:59 dregad Status new => acknowledged
2015-09-06 05:59 dregad Category bugtracker => db mssql
2015-09-06 05:59 dregad Target Version => 1.3.0-beta.3
2015-09-06 05:59 dregad Note Added: 0051381
2015-09-06 17:46 vboctoradmin Target Version 1.3.0-beta.3 => 1.3.0-rc.1
2016-01-12 03:36 atrol Target Version 1.3.0-rc.1 => 1.3.0-rc.2
2016-01-12 06:17 dregad Assigned To => dregad
2016-01-12 06:17 dregad Status acknowledged => resolved
2016-01-12 06:17 dregad Resolution open => fixed
2016-01-12 06:17 dregad Fixed in Version => 1.3.0-rc.1
2016-01-12 06:17 dregad Note Added: 0052296
2016-01-12 06:18 dregad Changeset attached => MantisBT master f0c3959b
2016-01-12 09:54 atrol Target Version 1.3.0-rc.2 =>
2016-01-25 16:21 atrol Status resolved => closed