PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'mail' cannot be null: UPDATE {simplenews_subscriber} SET snid=:db_update_placeholder_0, activated=:db_update_placeholder_1, mail=:db_update_placeholder_2, uid=:db_update_placeholder_3, language=:db_update_placeholder_4 WHERE (snid = :db_condition_placeholder_0) ; Array ( [:db_update_placeholder_0] => 9869 [:db_update_placeholder_1] => 1 [:db_update_placeholder_2] => [:db_update_placeholder_3] => 627 [:db_update_placeholder_4] => [:db_condition_placeholder_0] => 9869 ) in simplenews_subscriber_save() (line 1632 of /home/kitchena/public_html/sites/all/modules/simplenews/simplenews.module).

CommentFileSizeAuthor
#5 fix_registration.patch4.61 KBberdir

Comments

berdir’s picture

Status: Active » Postponed (maintainer needs more info)

It says what it is.

Somehow, Simplenews tries to save a subscriber with an empty mail address. I don't know how that could happen.

When reporting bugs, you need to report them so that we are able to reproduce them. There are two ways to do that.

a) Give us detailed steps on how to reproduce it on a clean/new installation of Simplenews. Have a look at #1400124: Undefined index: simplenews_subscriber in simplenews_build_unsubscribe_mail() when unsubscribing anonymous users to see how that could look like (You don't need to debug the code like that report did, just the detailed steps are important).

b) Provide us with a dump of your data (e.g. use the contact form on my profile) and then explain how to trigger that error there.

visum’s picture

My site is also throwing this error when a user tries to register a new account, whether or not he has chosen to subscribe to the one available newsletter.

Anonymous users have no problem subscribing through the block form, and existing users can subscribe without error.

I'll try to post again here soon with steps to reproduce.

miro_dietiker’s picture

Do you hide your email field or do you use tools like logintoboggan?
We didn't test the software with special addon modules that tweak the registration process too much.

As Berdir said, we'll need a proper report or we won't be able to help.

visum’s picture

Title: PDOException: SQLSTATE[23000]: What is this? » Can not create an account when email address is already subscribed to a newsletter
Version: 7.x-1.x-dev » 7.x-1.0-beta1

The error seems to occur when a person attempts to create an account using an e-mail address that is already subscribed to the newsletter

Steps to reproduce:

  • In a fresh install of Drupal 7.10, install and enable Simplenews 7.x-1.0-beta1
  • Give the Anonymous user permission to subscribe to a newsletter.
  • Enable the subscription block for the default newsletter.
  • In the newsletter settings (admin/config/services/simplenews/categories/1/edit), set the "Subscribe new account" to "Default on", and choose the the Single opt-in/out method.
  • From an unprivileged browser, use the subscription block to subscribe an e-mail address, like test@example.com
  • Visit the user registration page, and attempt to register an account with the e-mail address you used to subscribe to the newsletter.
  • Error!

Now...

From a privileged browser, go in to the newsletter subscription list and delete the e-mail address in question. Try to register the new account again, and the error doesn't appear.

Hope that helps.

berdir’s picture

Version: 7.x-1.0-beta1 » 7.x-1.x-dev
Status: Postponed (maintainer needs more info) » Needs review
StatusFileSize
new4.61 KB

Yes, that's perfect :)

The attached patch fixes the bug and adds test coverage for this case.

PS: There are very few reasons to use any other version than -dev because everything is commited against that, needs to be tested against that and will then find it's way into the next release.

miro_dietiker’s picture

Status: Needs review » Fixed

Just perfect. Great to have this covered too.

visum’s picture

Got it, thanks!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.