Not sure what is going on here, but maybe it is a bug with PHP. In your webform_node_update function, I noticed that you are doing the following...

$original_cids = array_keys($original->webform['components']);
$current_cids = array_keys($node->webform['components']);

$all_cids = $original_cids + $current_cids;

Given the following arrays, this does not give you what I would expect from PHP....

Adding two arrays array(1,2,3) and array(2,3,4) surprisingly gives the following...

ubuntu@ip-172-19-125-130:~/main/www$ php -a
Interactive shell

php > print_r(array(1,2,3) + array(2,3,4));
Array
(
    [0] => 1
    [1] => 2
    [2] => 3
)
php > 

However, if you use array_merge it works as expected....

ubuntu@ip-172-19-125-130:~/main/www$ php -a
Interactive shell

php > print_r(array_merge(array(1,2,3),array(2,3,4)));
Array
(
    [0] => 1
    [1] => 2
    [2] => 3
    [3] => 2
    [4] => 3
    [5] => 4
)
php > 

Patch to follow....

Comments

travist’s picture

Status: Active » Needs review
StatusFileSize
new551 bytes

Here is the patch.

travist’s picture

StatusFileSize
new977 bytes

Found some other offenders.

travist’s picture

Version: 6.x-3.11 » 6.x-3.x-dev
travist’s picture

Assigned: travist » Unassigned
travist’s picture

StatusFileSize
new1005 bytes

Probably should array_unique the merge...

quicksketch’s picture

Title: webform_node_update does not calculate the $all_cids correctly... » webform_node_update() does not calculate the $all_cids correctly
Status: Needs review » Fixed

This makes sense to me. The use of array_unique() seems a bit odd, though I realize this is because the array is numerically indexed, so doing a array_merge result in the same value being used twice with two different numeric keys.

Committed to both 3.x branches.

shawn dearmond’s picture

Status: Fixed » Needs review

@quicksketch: I don't see these committed to 6.x or master. Maybe they were not pushed? The last commit was six hours before you posted comment #6.

shawn dearmond’s picture

Status: Needs review » Reviewed & tested by the community

Tested it on D7, though, and it definitely works!

quicksketch’s picture

Status: Reviewed & tested by the community » Fixed

It's there now, sorry I don't push after every commit and it gets me in trouble some times.

Status: Fixed » Closed (fixed)

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