Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
When I try to create a new text field for a content created using cck field, I am getting this warning warning: Invalid argument supplied for foreach() in F:\Program Files\Apache Group\Apache2\htdocs\drupal-5.0\sites\all\modules\cck\text.module on line 328.
Comments
Comment #1
yched CreditAttribution: yched commentedI can't seem to reproduce.
The $item variable in text.module line 328 should always be an array.
Can you provide more info on your config (PHP version, MySQL version)
and on your field (which widget, which settings ?)
Comment #2
poldrack CreditAttribution: poldrack commentedI get the warning to. My php und mysql-version is:
MySQL-Datenbank 4.1.15
PHP 5.2.0
Comment #3
yched CreditAttribution: yched commentedWell, I can't reproduce with PHP 5.1 (I do not have a 5.2 test environment)
Can both of you provide an output of your content type (using "export" tab - requires enabling content-copy.module) ?
Is text the only field type which triggers this ?
Comment #4
BioALIEN CreditAttribution: BioALIEN commentedJust happened to me too - using the current CCK 1.3
Only seems to be doing it to text.module - I will do further investigations to check if anything else is causing this or try and narrow it down somehow.
Comment #5
yched CreditAttribution: yched commentedAs I wrote earlier, pasting an export of your content type may help :-)
Comment #6
BioALIEN CreditAttribution: BioALIEN commentedSorry for the delay, here's the info you requested - its a complete export of the node type that was causing the problem. Some information about my setup:
Drupal 5.1
PHP 5.2.0
MySQL database 5.0.27
Web server Apache/2.2.3 (Unix) mod_ssl/2.2.3 OpenSSL/0.9.8d DAV/2 PHP/5.2.0
Comment #7
sentinelcz CreditAttribution: sentinelcz commentedI try edit text file. This message appears. Note:
If I start update script, this message appears too..
warning: Invalid argument supplied for foreach() in \modules\cck\text.module on line 327.
warning: Invalid argument supplied for foreach() in \modules\cck\text.module on line 124.
Strange is If I try to fill new content, I have in “name” default value “f”.
Of course I haven’t set any default value in text field.
Next others text fields are without problem.
I am using
Apache: 2.0.59
PHP 5.2.1
MySql 5.0.27
Firefox 2.0.0.2
Export
$content[type] = array (
'name' => 'Acc Template',
'type' => 'acc_template',
'description' => 'Here you can fill new acc',
'title_label' => 'title field',
'body_label' => '',
'min_word_count' => '0',
'help' => 'Please fill all items carefully.',
'node_options' =>
array (
'status' => true,
'promote' => true,
'sticky' => false,
'revision' => false,
),
'comment' => '2',
'old_type' => 'acc_template',
'orig_type' => '',
'module' => 'node',
'custom' => '1',
'modified' => '1',
'locked' => '0',
);
$content[fields] = array (
0 =>
array (
'widget_type' => 'text',
'label' => 'Name',
'weight' => '0',
'rows' => '1',
'description' => 'You can fill maximum 40 characters.',
'field_name' => 'field_name',
'default_value_php' => '',
'group' => 'group_address',
'required' => '1',
'multiple' => '0',
'text_processing' => '0',
'max_length' => '40',
'allowed_values' => '',
'allowed_values_php' => '',
'field_type' => 'text',
'module' => 'text',
'default_value' => 'field_name',
),
);
Comment #8
BioALIEN CreditAttribution: BioALIEN commentedStrange is If I try to fill new content, I have in “name” default value “f”.
I also got this from my testing in #6.
Comment #9
jimyhuang CreditAttribution: jimyhuang commentedI found the bug.
If the label set to "name", than the $items infomations will loss when 'process form values' (line 325)
Comment #10
sentinelcz CreditAttribution: sentinelcz commentedGreat, thank you. Question is if this bug will be correct.
Comment #11
BioALIEN CreditAttribution: BioALIEN commentedI think jimyhuang is right. Both of these error cases use "name". Maybe it should be stated in advance during the widget creation screen so people are aware of these "reserved named"?
This would fix the issue by design!
Comment #12
yched CreditAttribution: yched commentedOooh. Nice catch. This is vicious.
This is related to the 'default value' widget in the field setting form.
It adds a field_(FIELD_NAME) form element, which of course conflicts with the regular 'field_name' element when FIELD_NAME == 'name' ...
This is most probably not restricted to text fields.
Unfortunately I'm under a pressing deadline, so I'm not really sure how this can be fixed right now.
Ugly workaround for now :
- _create_ your field with a name that is not 'name'
- later on, change the label (does not affect the machine-readable field name)
Comment #13
yched CreditAttribution: yched commentedOK, turns out the fix was rather simple after all - you guys probably had more work pinning this down to 'name' labels. Thanks all.
Should be fixed in latest (pre 1.5) 1.x-dev code
For once, a bug specific to anglophone users :-)
Comment #14
(not verified) CreditAttribution: commented