I was getting a 'bad arguments' php error for implode around line 211. I'm using subform_element with the addnode CCK module and I only have one node-type available to choose from. My guess is that form['#parents] isn't an array in this case which causes the error. I didn't really dig around the code much because I fixed it for my situation so quickly. Here's what I did:
Starting at line 210:
elseif(is_array($form['#parents'])) {
$form['#name'] = $prefix. '['. implode('][', $form['#parents']) .']';
}else{
$form['#name'] = $prefix. '['. $form['#parents'] .']';
}
(I'm having issues creating good patches right now otherwise I would have attached one)
Because subform_element is used with other modules this solution may or may not be for everyone. I just thought I'd share it.
Comments
Comment #1
fagohm, I think usually the parents has to be an array at this stage of form processing.
So the question better is - why it is not?
To clarify this, we need to know how it is invoked and for which form element the error occurs.
So I set to addnode, to gather more information. (the bug might be in both modules)
Comment #2
mykle commentedI'm having the same problem in Drupal 5.3. I have traces turned on in the devel module, so I have a complete stack trace for this. However, it's quite large and sort of strangely-formatted after i cut and paste it. But i'll try. (Wherever it says ($form), that's the form array, which is quite vast.)
The original error seems to be that the second argument to implode() is null/undef.
--------
this is with an AddNode CCK field added to the Story type, pointing to an Image type provided by the Image module.
Comment #3
mykle commentedThis only happens when one of the types of the Node Reference is an Image object from the Image module.
subform_element is being handed a garbled form array there. $form[thumbnail] is a child with only one property: #after_build_done = true.
Perhaps this property is supposed to be set on $form[images][thumbnail] instead?
This raises a bug classification question: is the bug in image? addnode? subform element? I don't know. I'm setting it to image for now.
Comment #4
sunSorry, I have no idea either. Please have a look at the issue queue - Image maintainers are buried already.