Hi,

I'm getting this error on enabling feature for a webform:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'machine_name' cannot be null: UPDATE {webform_component} SET machine_name=:db_update_placeholder_0
WHERE (cid = :db_condition_placeholder_0) ; Array
(
[:db_update_placeholder_0] =>
[:db_condition_placeholder_0] => 1
)
in webform_features_webform_component_insert() (line 150 of /path/to/files/sites/all/modules/webform_features/webform_features.module).

I have upgraded Webform to release 7.x-3.20

Any ideas?

Thanks.

Comments

bmeme’s picture

I don't know if it is the same context, and the issue is also quite old, BUT:

I have the same error in my drupal instance with:

* Webform 7.x-4.2+16-dev
* Webform Features 7.x-3.0-beta3+2-dev
* Webform Term Opts 7.x-4.0
* Options element 7.x-1.12
* Form Builder / Form Builder Webform UI 7.x-1.7

The patch is quite simple to apply: in "webform_features_webform_component_insert()" function, the db_update use $component['machine_name'] as field, but this does not exist. You have to use $component['form_key'].

Attached you'll find my patch. Bye!

bmeme’s picture

Status: Active » Needs review
StatusFileSize
new745 bytes

Sorry use this patch... :)

duaelfr’s picture

@bmeme That module is NOT compatible with webform 4.x, sorry.
I wish I had more time to maintain it...

The fact is that your components might already have a machine_name because it should be created on module install if components already exists or during the component creation. If they don't have one, that's an other issue that we'll have to fix.

kyletaylored’s picture

We're using Webform 3.x. This happens when we try to create a NEW Webform and upon hitting "Publish", this is the error we get.

Patch in #2 definitely works for us.

sdstyles’s picture

StatusFileSize
new745 bytes

I use webform_layout and webform 7.x-4.10 with webform_features 7.x-3.0-beta3 and I have this error:
Notice: Undefined index: machine_name in webform_features_webform_component_insert() when I use a component from webform_layout module.

Above patch #2 solved the issue, but I was forced to re-roll it to apply it with git.

socialnicheguru’s picture

Status: Needs review » Reviewed & tested by the community

The patch definitely works and is needed.
this worked for webform 7.4

gold’s picture

Version: 7.x-3.0-beta3 » 7.x-3.x-dev
Category: Support request » Bug report

Just wanting to bump this.

I've just spent a few hours tracking a clients bug to this issue. The patch here at #5 is working for me also. Any chance we can get this merged in?

miteshmap’s picture

Sure @Gold, I'll try to merge it ASAP.

  • miteshmap committed b36d590 on 7.x-3.x authored by sdstyles
    Issue #2247925 by sdstyles, bmeme: PDOException: SQLSTATE[23000] error...
miteshmap’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

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

nikolabintev’s picture

Here is a patch that could be applied against 7.x-4.x dev version.

nikolabintev’s picture

Version: 7.x-3.x-dev » 7.x-4.x-dev
varshith’s picture

@miteshmap
Can you pls reopen this issue as this issue is still there for 7.x-4.x?
The patch above works for 7.x-4.x-dev

miteshmap’s picture

Status: Closed (fixed) » Needs review
rosk0’s picture

Status: Needs review » Reviewed & tested by the community

Looks good. Should be committed.

Also it would be awesome to release new version with this as there is some unreleased stuff in 7.x-4.x: #2722991: PHP Notice: Undefined index: email in webform_features_export_render(), #2688039: Introduce a way to alter webform on export/import and bug fix without the issue on DO https://git.drupalcode.org/project/webform_features/-/commit/bc40b5f62c7... .