Topic-icon G+ signup leads to 1064 error since upgrade to 5.2.2

Active Subscriptions:

None
12 years 4 months ago - 12 years 4 months ago #40366 by davlar
This seems to only happen on the G+ login and only for new users. Connecting existing users seems to work fine. Any thoughts?

File Attachment:
Last edit: 12 years 4 months ago by davlar.
The topic has been locked.
Support Specialist
12 years 4 months ago #40372 by alzander
Can you change the go to the Joomla -> Global Configuration area and set the following:
* Error Reporting: Maximum
* Debug System: Yes
* GZip Compression: No

Then, try to recreate that error and see if there is any messages that may help narrow down what's happening. This is not something other users have reported, so we'll need to narrow down what's going wrong.

Thanks,
Alex
The topic has been locked.
Active Subscriptions:

None
12 years 4 months ago #40384 by davlar
Here is the full report with everything expanded.
<truncated>
The topic has been locked.
Support Specialist
12 years 4 months ago #40432 by alzander
Thanks for the error log. That helped us narrow down the cause. It looks like there's a bug in a very specific SQL query of ours. That query is only run if the new user logging in would have an automatically generated username that is the same as an existing user. For example, there is already a user "john.smith" on your site. If a new, different, John Smith comes, JFBConnect will try to automatically generate the username john.smith. Since that can't be used, JFBConnect *should* be trying to generate john.smith1. That query for that collision seems to be broken.

With that long explanation out of the way, the solution is a one line change in the /libraries/sourcecoast/utilities.php file. Around line 622, you'll see:
$query = "SELECT CAST(REPLACE(username, " . $dbo->quote($prefix) . ", '') AS INT) suffix FROM #__users WHERE " . $dbo->qn('username') . " ~ '^" . $prefix . "[0-9]+$' ORDER BY " . $dbo->qn('suffix') . " DESC LIMIT 1";
Please replace that line with:
$query = 'SELECT CAST(REPLACE(username, ' . $dbo->quote($prefix) . ', "") AS UNSIGNED) suffix FROM #__users WHERE `username` REGEXP "^' . $prefix . '[[:digit:]]+$" ORDER BY `suffix` DESC LIMIT 1';
Please let me know how that goes. This was a bug introduced in our last (v5.2.2) release, and we weren't aware of it until now. Obviously, this fix will be in the next release, but we'd love to have confirmation of it.

Thanks,
Alex
The topic has been locked.