Bug #22063
closedBackend login impossible with MSSQL via ODBC due to FetchRow() result
0%
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)
Updated by Xavier Perseguers over 14 years ago
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...
Updated by Xavier Perseguers over 14 years ago
Please have a look at bug #4640 and report here or there if it helps fixing your problem.
Updated by Golo Meierhenrich over 14 years ago
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.
Updated by Xavier Perseguers over 14 years ago
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?
Updated by Golo Meierhenrich over 14 years ago
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.
Updated by Xavier Perseguers over 14 years ago
OK, I did some test and configured a website with MSSQL and odbc_mssql instead of native driver mssql and I could not log in anymore. Will have a look soon.
Here's the tutorial how to configure TYPO3 to use either mssql native driver or ODBC one: http://xavier.perseguers.ch/tutoriels/typo3/articles/mssql-database.html
Updated by Xavier Perseguers over 14 years ago
Patch of bug #4640 solves this issue. No need for another patch.