Hi,
I'm getting an Integrity constraint violation in certain circumstances. To reproduce:
(1) brand new drupal 7 site with ajax_example and simplenews_content_selection (scs)
(2) log in as user 1
(3) create 40 articles
(4) go to admin/content/scs_node_selection
(5) click on the administration link in the error message
(6) check the articles checkbox
(7) go to admin/content/scs_node_selection
(8) select three random articles and give a title
(9) click sort nodes
(11) click create newsletter
Now I'm getting this error (see also image):
Error
Error message
Notice: Undefined property: stdClass::$ajax_example in ajax_example_node_insert() (line 114 of /path/to/drupal/sites/all/modules/contrib/examples/ajax_example/ajax_example_node_form_alter.inc).
Notice: Undefined property: stdClass::$ajax_example in ajax_example_node_insert() (line 115 of /path/to/drupal/sites/all/modules/contrib/examples/ajax_example/ajax_example_node_form_alter.inc).
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'example_1' cannot be null: INSERT INTO {ajax_example_node_form_alter} (nid, example_1, example_2) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => 43 [:db_insert_placeholder_1] => [:db_insert_placeholder_2] => ) in ajax_example_node_insert() (line 117 of /path/to/drupal/sites/all/modules/contrib/examples/ajax_example/ajax_example_node_form_alter.inc).
The website encountered an unexpected error. Please try again later.
I'm aware that ajax_example is meant solely as a example, not a robust full-fledged module. Still, we might want to avoid such ugly errors.
Cheers,
Albert
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | 1832918-3-examples-integrity-constraint.patch | 937 bytes | alberto56 |
| Screen Shot 2012-11-05 at 8.18.28 PM.png | 89.12 KB | alberto56 |
Comments
Comment #1
SebCorbin commentedThe error is caused by the examples module, not Simplenews Content Selection. You'll get the same error if you try to create a node, even if SCS is disabled.
Just disable all your example modules.
Comment #2
alberto56 commented@SebCorbin thanks! Must have been tired yesterday, I did not notice the clear reference to the examples module.
Albert
Comment #3
alberto56 commentedHere is a patch for the examples module -- I'm just checking if the property exists before writing to the database. This is a more graceful way of dealing with it, perhaps.
Comment #4
alberto56 commentedComment #5
mile23"Site should not crash when..."
Agreed. :-)
Committed: http://drupalcode.org/project/examples.git/commitdiff/0379bcd9722d5679a6...
Comment #6
dsteplight commentedI got this error by accidentally enabling the uuid_services_example and uuid_default_entities_example modules without realizing that he Examples module was already disabled. I found myself in a scenario where this error message was getting in the way of me trying enabling the Examples module via the Module Listing page. It was also preventing me from using drush to enable the Examples module. To solve the problem, I had to enable the Examples module via the command line in mysql. I was able to refresh the page and could visually verify the error message was no longer a problem.
You can check to see the state of your modules in mysql by running this command "SELECT name,status FROM system WHERE type='module';" . Make sure "xamples" is set to "1" using an UPDATE sql statement, and that should allow you to refresh your page and disable any example modules that you need via your site admin pages.
Comment #7.0
(not verified) commentedissue has changed projects