Bug #22063
closed
Backend login impossible with MSSQL via ODBC due to FetchRow() result
Added by Golo Meierhenrich over 14 years ago.
Updated over 14 years ago.
Category:
Database API (Doctrine DBAL)
Description
When setting up Typo3 with dbal using MS SQL Server via ODBC you always get thrown back to the backend login when entering the correct credentials.
Tested with SQL Server 2005 SP3/PHP 5.3.1 and SQL Server 2005 Standard SP2/PHP 5.2.12.
Problem occures because sql_fetch_row returns an empty result although SQL Server returns "1" when processing the query
SELECT COUNT FROM "be_sessions" WHERE "ses_id" = '<actual session id>'
On MySQL FetchRow() returns an array with associative (coulmn name) and numeric indices, on MSSQL/ODBC the array has only associative (empty) indices. sql_fetch_rows deletes all associative entries to prevent doubles, so we get an empty result.
I fixed it (quick and dirty) with inserting the following code at line 1495 in class.ux_t3lib_db.php:
if ($res->databaseType == 'odbc_mssql')
{ $c = 0;
foreach($output as $key => $value){
$output[$c] = $output[$key];
$c++;
}
}
(issue imported from #M13433)
I do not like "quick and dirty" hacks... But anyway, your hack cannot apply to current version of class.ux_t3lib_db.php as line 1495 lies exactly between two methods in current code...
Please have a look at bug #4640 and report here or there if it helps fixing your problem.
I don't like "quick & dirty" as well, but I just needed a way to make it work. I'd rather prefer a better solution from someone who knows the system better than me. That's why I went here.
Actually this applies to the version of dbal delivered with the 4.3.1 package of typo3. Sorry for not pointing that out further.
Line 1495 says: foreach ($output as $key => $value) {
I will check the related bug and give you feedback as soon as possible.
There is a few places in DBAL were the "mssql" driver is tested, meaning using odbc_mssql will fail to be interpreted as a MSSQL link. Is use of "mssql" driver instead an option for you?
I can confirm that the patch from the related bug 0004640 solves the login problem. Only the line numbers have to be updated for the actual version.
Patch of bug #4640 solves this issue. No need for another patch.
Also available in: Atom
PDF