I am having issues running the newest release of Roundcube on my Windows server with MSSQL 2012 as a backend. It ran version 1.3.4 with no issues at all. It is running under PHP 7.2.24.
The problem is this: anytime Roundcube attempts to write something to the database, it reports an error back to the user. For instance, the first time a user logs into Roundcube, it reports that it can't create the user. Or, when you try to add a contact, it tells you that it failed. However...it doesn't fail, the SQL Insert actually succeeds - the row is inserted into the SQL database. What I suspect is that the rcube_db.affected_rows function is always reporting back zero, so that RoundCube thinks the insert failed, when it actually succeeded.
For instance, when a user tries to log in for the first time, Roundcube reports "Login failed" to the user, and the error log reports:
[May/25/2020 13:12:48 -0400]: <l61ucvcr> PHP Error: Failed to create new user in D:\inetpub\wwwroot\RoundCube\program\lib\Roundcube\rcube_user.php on line 703 (POST /?_task=login&_action=login)
[May/25/2020 13:12:48 -0400]: <l61ucvcr> PHP Error: Failed to create a user record. Maybe aborted by a plugin? in D:\inetpub\wwwroot\Roundcube\program\include\rcmail.php on line 652 (POST /?_task=login&_action=login)
Despite these reports, the user record did actually get created in the SQL table. So if they try to log in again using the exact same credentials, the login then succeeds.
This is a bone stock Roundcube install, fresh out of the box, no other plugins.
Doing a little bit of debugging, it appears to be that MSSQL does not return the inserted row as the resultset, at least by default. Looking at line 639 of /program/lib/Roundcube/rcube_user.php:
if ($dbh->affected_rows($insert) && ($user_id = $dbh->insert_id('users'))) {
// create rcube_user instance to make plugin hooks work
$user_instance = new rcube_user($user_id, array(
My debugging shows that while the row is created successfully, $dbh->insert_id('users') contains nothing, and therefore Roundcube thinks the insert failed. It appears to be the case for EVERY insert function within Roundcube. I will admit that PHP is very far from my language of choice.
I suspect that nobody actually tested this version of Roundcube under MSSQL? I can't be the only one experiencing this.