Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to create new users - database error - no default value for riverid #1122

Merged
merged 2 commits into from May 29, 2013
Merged

Unable to create new users - database error - no default value for riverid #1122

merged 2 commits into from May 29, 2013

Conversation

solarissmoke
Copy link
Contributor

On a clean install of Ushahidi, I tried to create an account from /ushahidi/login. The following error is thrown:

Database error: Field 'riverid' doesn't have a default value - 
INSERT INTO `users` (`email`, `username`, `password`, `name`) VALUES ('test@example.com', '281921918', 'a05534c598a1c092fb9ac86d2f0c8261b7d49fcc3d15c06f14', 'test')

Same thing happens when I try to create a user through the admin interface (/ushahidi/admin/users/edit/).

When riverid is disabled, the controller does not supply a value for $user->riverid, and the database does not have a default value, hence the fatal error.

Also note that the username value above is a large integer - I'm not sure why that is, but it also looks like a bug?

@solarissmoke
Copy link
Contributor Author

The attached patch fixes the issue for me. Another alternative would be to change the database schema so that riverid has an empty string as the default value.

@aoduor
Copy link
Member

aoduor commented May 22, 2013

Hey @solarissmoke, what version of Ushahidi are you using? Just tested this with 2.7 and was unable to reproduce.

@solarissmoke
Copy link
Contributor Author

@aoduor, I can reproduce it in 2.7 as well as the HEAD of the develop branch. I did a completely clean install and it still happens for me. Note that riverid has to be disabled in the config (riverid.enabled should be false).

Also, if you just look at the logic, there is a problem. riverid does not have a default value in the database, but the constructor only gives it a value inside the if block (when riverid is enabled). It should be setting a value all the time given that there is no default.

@rjmackay
Copy link
Contributor

@solarissmoke What version of mysql are you running?
I doubt it makes any difference, but I'd like to figure out why this is break for you but not others before merging it in.
However the change itself looks good.

@solarissmoke
Copy link
Contributor Author

@rjmackay I can reproduce it on two systems, one running version 5.1.46 and the other version 5.5.31.

@rjmackay
Copy link
Contributor

OK going to merge this since it seems sane anyway. But can't figure out why you're getting errors while I'm not.
Version of php maybe..

@rjmackay rjmackay closed this May 29, 2013
@rjmackay rjmackay merged commit ace866f into ushahidi:develop May 29, 2013
@solarissmoke solarissmoke deleted the riverid-bug branch June 2, 2013 04:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants