Contribution error

I'm getting this error when making a submission using the Contribution form:

exception 'Zend_Db_Statement_Mysqli_Exception' with message
'Mysqli statement execute error :
Field 'contributor_id' doesn't have a default value'
in /path/to/application/libraries/Zend/Db/Statement/Mysqli.php:214

Is this a bug and/or could something in my server environment be causing the form to throw a fatal error on submit, while nevertheless successfully saving the item?

I suspect that this is something that wasn't a problem in older MySql versions, but crops up with newer versions.

The item is being saved, but the record for who contributed the item is not.

What version of Contribution are you using? And, could you give the complete stack trace?

Thanks

Contribution 3.0.1
GuestUser 1.1.1

also...

Omeka 2.2.2
PHP 5.3.3 (apache2handler)
OS Linux 2.6.32-431.29.2.el6.x86_64 x86_64
MySQL Server 5.6.21
MySQL Client 5.1.73
Apache Apache/2.2.15 (Red Hat)

===================================

#0 /path/to/htdocs/application/libraries/Zend/Db/Statement.php(303): Zend_Db_Statement_Mysqli->_execute(Array)
#1 /path/to/htdocs/application/libraries/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#2 [internal function]: Zend_Db_Adapter_Abstract->query('INSERT INTO
/`
om...', Array)
#3 /path/to/htdocs/application/libraries/Omeka/Db.php(79): call_user_func_array(Array, Array)
#4 /path/to/htdocs/application/libraries/Omeka/Db.php(252): Omeka_Db->__call('query', Array)
#5 /path/to/htdocs/application/libraries/Omeka/Db.php(252): Omeka_Db->query('INSERT INTO
\`
om...', Array)
#6 /path/to/htdocs/application/libraries/Omeka/Record/AbstractRecord.php(543): Omeka_Db->insert('ContributionCon...', Array)
#7 /path/to/htdocs/plugins/Contribution/controllers/ContributionController.php(340): Omeka_Record_AbstractRecord->save()
#8 /path/to/htdocs/plugins/Contribution/controllers/ContributionController.php(273): Contribution_ContributionController->_linkItemToContributedItem(Object(Item), NULL, Array)
#9 /path/to/htdocs/plugins/Contribution/controllers/ContributionController.php(75): Contribution_ContributionController->_processForm(Array)
#10 /path/to/htdocs/application/libraries/Zend/Controller/Action.php(516): Contribution_ContributionController->contributeAction()
#11 /path/to/htdocs/application/libraries/Zend/Controller/Dispatcher/Standard.php(308): Zend_Controller_Action->dispatch('contributeActio...')
#12 /path/to/htdocs/application/libraries/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#13 /path/to/htdocs/application/libraries/Zend/Application/Bootstrap/Bootstrap.php(101): Zend_Controller_Front->dispatch()
#14 /path/to/htdocs/application/libraries/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#15 /path/to/htdocs/application/libraries/Omeka/Application.php(79): Zend_Application->run()
#16 /path/to/htdocs/index.php(23): Omeka_Application->run()
#17 {main}

In comparing our dev and production servers (the form works on the dev server), the only differences I've found is that the production server (where the problem exists) does not have the apc or uploadprogress extensions installed. Additionally, the site is served over SSL/HTTPS. I doubt any of that is relevant (well maybe uploadprogress) but who knows.

hmm...I was expecting a difference in the MySql versions, but oh well.

Either way, I'm a little unsure of what's happening, but it did get to some code that appears to be a bug. That version of Contribution shouldn't actually be using a contributor_id at all. However, in ContributionController.php line 334, there's a line that think it still is.

So, maybe try commenting out 334:

$linkage->contributor_id = $contributor->id;

and see if that fixes it.

We are having this problem right now. It appears that the form data is being saved, but after the submit button has been clicked, it just shows a page stating that Omeka has encountered an error. In the log I have the same error message as the original post here.

I have also already commented out the line on 334, but nothing changed.

Has anyone come up with a solution for this yet?

Hello! Just to follow up on what Ed wrote above, we are still have this perplexing issue. When a user makes a contribution on our Community of Gardens website they encounter an error page after submitting, making it appear as if their contribution did not go through. The story does go through in fact, but it does not save the user id attached to the story.

The error message we get is:

exception 'Zend_Db_Statement_Mysqli_Exception' with message
'Mysqli statement execute error :
Field 'contributor_id' doesn't have a default value'
in /path/to/application/libraries/Zend/Db/Statement/Mysqli.php:214

We tried commenting out the line on 334 but continue to get the message. It's important to note that site changes are made in a development environment, then pushed to a production environment. We do not get this error message in the development environment, but encounter in the production environment. We are hoping someone might have an idea what the difference in the development and production environments could be that would cause this discrepancy. The only thing I can think of is that production uses SSL, but this doesn't seem like it should make a difference.

Thanks,
Kate

kate,

We _think_ we've tracked this down to some errors in previous upgrade steps, and we're currently testing a fix. There are lots of variations we want to look at before an official release. The current thing we're testing is here in GitHub if you want to look.

Hello,

Seems like I'm experiencing a similar problem - the contributed items are also being saved but no contributor information is logged and no e-mail confirmations are sent out. My error message is as follows:

Zend_Db_Statement_Mysqli_Exception
Mysqli prepare error: Unknown column 'anonymous' in 'field list'

#0 /var/www/omeka/omeka-2.2.2/application/libraries/Zend/Db/Statement.php(115): Zend_Db_Statement_Mysqli->_prepare('INSERT INTO `om...')
#1 /var/www/omeka/omeka-2.2.2/application/libraries/Zend/Db/Adapter/Mysqli.php(388): Zend_Db_Statement->__construct(Object(Zend_Db_Adapter_Mysqli), 'INSERT INTO `om...')
#2 /var/www/omeka/omeka-2.2.2/application/libraries/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Adapter_Mysqli->prepare('INSERT INTO `om...')
#3 [internal function]: Zend_Db_Adapter_Abstract->query('INSERT INTO `om...', Array)
#4 /var/www/omeka/omeka-2.2.2/application/libraries/Omeka/Db.php(79): call_user_func_array(Array, Array)
#5 /var/www/omeka/omeka-2.2.2/application/libraries/Omeka/Db.php(252): Omeka_Db->__call('query', Array)
#6 /var/www/omeka/omeka-2.2.2/application/libraries/Omeka/Db.php(252): Omeka_Db->query('INSERT INTO `om...', Array)
#7 /var/www/omeka/omeka-2.2.2/application/libraries/Omeka/Record/AbstractRecord.php(543): Omeka_Db->insert('ContributionCon...', Array)
#8 /var/www/omeka/omeka-2.2.2/plugins/Contribution/controllers/ContributionController.php(338): Omeka_Record_AbstractRecord->save()
#9 /var/www/omeka/omeka-2.2.2/plugins/Contribution/controllers/ContributionController.php(273): Contribution_ContributionController->_linkItemToContributedItem(Object(Item), NULL, Array)
#10 /var/www/omeka/omeka-2.2.2/plugins/Contribution/controllers/ContributionController.php(75): Contribution_ContributionController->_processForm(Array)
#11 /var/www/omeka/omeka-2.2.2/application/libraries/Zend/Controller/Action.php(516): Contribution_ContributionController->contributeAction()
#12 /var/www/omeka/omeka-2.2.2/application/libraries/Zend/Controller/Dispatcher/Standard.php(308): Zend_Controller_Action->dispatch('contributeActio...')
#13 /var/www/omeka/omeka-2.2.2/application/libraries/Zend/Controller/Front.php(954): Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#14 /var/www/omeka/omeka-2.2.2/application/libraries/Zend/Application/Bootstrap/Bootstrap.php(101): Zend_Controller_Front->dispatch()
#15 /var/www/omeka/omeka-2.2.2/application/libraries/Zend/Application.php(366): Zend_Application_Bootstrap_Bootstrap->run()
#16 /var/www/omeka/omeka-2.2.2/application/libraries/Omeka/Application.php(79): Zend_Application->run()
#17 /var/www/omeka/omeka-2.2.2/index.php(23): Omeka_Application->run()
#18 {main}

Check the mail folder of your web hosting (sometimes in the same folder as your domain) for bounced emails. I had a problem recently with emails not sending and it turned out that Dreamhost requires the admin email to be (at)mydomainname and not the gmail address I was using.

Thanks mebrett - but e-mail sending is just part of the problem here. I probably also should have mentioned that users get redirected to an error page after clicking on the "Contribute" button...