When attempting to recreate features through the UI (that is, when I visit /admin/structure/features/FEATURE_NAME/recreate) on one of my sites, i sometimes get this fatal error:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'Advanced-filtered_html' for key 'PRIMARY': INSERT INTO {ckeditor_input_format} (name, format) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1); Array ( [:db_insert_placeholder_0] => Advanced [:db_insert_placeholder_1] => filtered_html ) in ckeditor_install() (line 54 of /home/steve/www/drupal_7/sites/all/modules/ckeditor/ckeditor.install).

Why on earth is ckeditor_install() being invoked here?

Also, this happens intermittently, but I'm not sure what magic ritual of cache clearing and feature reverting makes it go away.

CommentFileSizeAuthor
#8 pdoexception-2416907-9653587.patch843 bytesrich.yumul
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

steve.m’s picture

Version: 7.x-2.2 » 7.x-2.3

So this appears to happen in features.export.inc at line 782 when features_get_default() decides to call

$cache[$component][$alter][$m] = call_user_func("{$m}_{$default_hook}");

with $default_hook = 'install'

This seems like a bad idea?

hefox’s picture

What is calling features_get_default with 'install'?

if ($default_hook == 'install') {
  print_r(debug_backtrace());
}
hefox’s picture

Status: Active » Postponed (maintainer needs more info)
steve.m’s picture

So far I've seen it happen with apachesolr and ckeditor. But then most of the time it works fine. I'll pull a backtrace next time I see it happen.

bbu23’s picture

subscribe

hefox’s picture

@bbu23 you don't need to comment to subscribe, just press the link to follow to the right side.

rich.yumul’s picture

Should the _install hook be called when exporting features?

Or should ckeditor_install() do a check to see if the entries exist first?

What's the correct behavior supposed to be?

rich.yumul’s picture

Here's a patch that seemed to eliminate the issue. Can somebody check it out?

hefox’s picture

That's a bandaid patch -- I'd never add it features as it's covering up a bug instead of finding /why/ it's happening. that function shouldn't be called with 'install'.

baldwinlouie’s picture

I had this issue happen to me. Its not a problem with the Features module. In my case, I found a contrib module that was declaring 'install' as the default hook in hook_features_api(). What you should do is to look at all the modules that are declaring hook_features_api() and see if it does something like this

      "default_hook" => 'install'
dmsmidt’s picture

Thanks baldwinlouie, #10 was also the problem in my case (md_slider module).

vintorezxxi’s picture

@dmsmidt +1. Same happened to me.

hefox’s picture

Is there a corsponding issue to fix this in the problematic module?

I sorta doubt more then 1 module has done this mistake

mcdoolz’s picture

So was there a fix for this? I've happened upon the same error and have MD Slider installed, but I'm not quite understanding why it's appearing??

http://megadrupal.com/comment/3505

tomrog’s picture

So far, owners of MD Slider didn't care enough to update one line of code - we have to do it ourselves ;] The worst thing is that error points to CK Editor when infact is cause by MD Slider.

After uncommenting line with default_hook in MD Slider as suggested in comment from #14 link, the problem goes away ;)

ggevalt’s picture

I want to confirm that the fix outlined in 14 and 15 works with one exception. I think tomrog meant to COMMENT out (or delete) the code line in mdslider.module as referred to in #14 link.

Thanks alot folks. This really helped.

cheers,
geoff

rprager’s picture

I just ran into this issue with CKEditor, MD Slider, and Bootstrap Tour. I was able to workaround the issue by clicking the "Create Feature" tab from the main Features page. Without actually creating a feature, I then went back and was able to recreate features without the errors. I haven't had a chance yet to dig into the code to understand why this seems to resolve the issue.