I catch this error with "pid" (parent id) field when I try revert features with webforms.
I investigated code of webform_component_insert() and this issue can be fixed with an one line.
PDOException: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'pid' cannot be null: [error]
INSERT INTO {webform_component} (nid, cid, pid, form_key, name, type, value, extra, required, weight)
VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2,
:db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6,
:db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9); Array
(
[:db_insert_placeholder_0] => 126022
[:db_insert_placeholder_1] => 1
[:db_insert_placeholder_2] =>
[:db_insert_placeholder_3] => first_name
[:db_insert_placeholder_4] => First name
[:db_insert_placeholder_5] => textfield
[:db_insert_placeholder_6] =>
[:db_insert_placeholder_7] =>
a:16:{s:13:"title_display";s:6:"before";s:17:"description_above";i:0;s:7:"private";i:0;s:15:"wrapper_classes";s:8:"clearfix";s:11:"css_classes";s:0:"";s:5:"width";s:0:"";s:9:"maxlength";s:0:"";s:12:"field_prefix";s:0:"";s:12:"field_suffix";s:0:"";s:8:"disabled";i:0;s:6:"unique";i:0;s:11:"description";s:0:"";s:11:"placeholder";s:0:"";s:10:"attributes";a:0:{}s:8:"analysis";b:0;s:18:"translated_strings";a:1:{i:0;s:53:"webform:821eaefb-79b9-43c5-86d2-890f89fcf66d:1:#title";}}
[:db_insert_placeholder_8] => 1
[:db_insert_placeholder_9] => 0
)
in webform_component_insert() (line 798 of webform/includes/webform.components.inc).
Comments
Comment #2
aexchecker commentedComment #3
aexchecker commentedComment #4
danchadwick commentedHmmmm. Sounds like a problem with features, no?
Comment #5
amoebanath commentedI'm also experiencing this error, but not on any action related to features. I'm struggling to reproduce locally though... I'll dig a little deeper.
Comment #6
aexchecker commented@DanChadwick
Yes and No.
Yes -- features build data with no "pid" field and I'll have a time to create a patch for that bit late (because features should generate correct data).
No -- we already have simple check and correction for fields ("value", "required", "extra/private") on 765-767 lines and, I think, it will good to add an one line to check and correction "pid" field in the same place.
I think both modules have owned responsibility for this issue; for webform's side we have this fix; for features' side I'll create fix on weekend (I expect that it will take some time).
Comment #7
danchadwick commentedI gonna disagree here. The general webform stragegy is to NOT supply error-checking code for invalid data that can't happen as a consequence of correct operation or history (e.g. feature added and existing data couldn't be migrated). This leads to lots of misunderstanding about the responsibility of the caller. It also leads to code bloat -- in an already-huge module.
Without searching git, I'm not sure why those other array elements are error-checked, but I'd venture that they have to do with handing old webform created before the feature was added. This isn't the case with pid.
So I think we should close this as words as designed.