0

After creating a default meta entry in Sprout SEO. Any subsequent updates aren't saved and I get an error message "Couldn't save the default"

Using:

  • Craft 2.4.2725
  • Sprout SEO 1.1.1

Has anyone else come across this?

3
  • Do you see any related errors in your logs (craft/storage/runtime/logs/sproutseo.log)? Dec 22 '15 at 20:20
  • I don't see a sproutseo.log but I do see craft.log. Not sure what to look for inside the craft log with no obvious errors.
    – Taylor
    Dec 22 '15 at 20:47
  • The only thing I have been able to track down is that for some reason the id column of the sproutseo_defaults table wasn't auto incrementing. The first entry would result in a 0. haven't been able to figure out why.
    – Taylor
    Dec 23 '15 at 21:36
2

This issue came as a result of the MySQL DB sql_mode including the NO_AUTO_VALUE_ON_ZERO mode which affects how auto_increment columns work. When trying to create a new row entry it will only auto_increment if null is passed.

Full explanation here:

http://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_no_auto_value_on_zero

This setting matched with the way the controller's actionSaveDefault function was setting the id to a blank value rather than a null value caused it to trigger this DB behavior of writing a 0 rather than auto_increment.

While the cause of the issue is not Craft or SproutSEO specific, this answer might help anyone else with the issue.

  1. Check your MySQL DB sql_mode
  2. If, NO_AUTO_VALUE_ON_ZERO is set make sure you're passing null if you want it to auto_increment
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.