View Issue Details

IDProjectCategoryView StatusLast Update
0020074mantisbtdb mssqlpublic2016-01-25 16:21
Reporteralex.volkov Assigned Todregad  
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
PlatformMicrosoftOSWindows Server 2012 R2 
Product Version1.3.0-beta.2 
Fixed 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 (MantisBT master f0c3959b)

Related Changesets

MantisBT: master f0c3959b

2015-05-16 23:59

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.
Affected Issues
0020074
mod - core/database_api.php Diff File