I've just upgraded CCK to the latest CVS and am now running the following versions:

drupal - 4.7.4
content.module - 1.56.2.29
content_admin.inc -1.12.2.19
content_views.inc - 1.1.2.7
fieldgroup.module - 1.1.2.2
number.module - 1.27.2.11
optionwidgets.module - 1.8.2.3
text.module - 1.32.2.14

When I go to admin/node/types/CONTENT-TYPE/fields, on some content types, I see the following error:

Warning: in_array(): Wrong datatype for second argument in /home/v/c/vcommunityaab/public_html/modules/cck/content_admin.inc on line 410

The error is often listed more than once and at first, I thought there was a correlation between the number of times that it appears and the number of groups in the content type, but that is not the case.

Also, it doesn't appear on every content type.

Any ideas?

Regards

Patrick

Comments

KarenS’s picture

I think I see what might be causing this. Try changing line 410 to:

if (in_array($fname, (array) $disabled)) {
        
KarenS’s picture

Also, what content types is this showing up on? Are they CCK types or something else?

KarenS’s picture

I think I know what's going on. I'll bet this is showing up only for content types that have no fields. Is that right?

Patrick Nelson’s picture

Hi Karen,

They are all CCK content types, but all of the ones that it shows up on have fields.

Regards

Patrick

Patrick Nelson’s picture

Also, your change above does seem to make the problem go away. Would that be a permanent fix, then?

KarenS’s picture

I'm still confused a bit because it doesn't look like this should happen, so I'm going to keep digging around. But, yes, that will be the fix.

yojoe’s picture

I just got the same error for one of my content types, after upgrading to cck-4.7.x-1.2
The addition of the (array) type hint to line 410 fixed it.

bluecobalt’s picture

I had the same error.

The fix from Karen took care of it.

yched’s picture

Karen : wouldn't adding

$form['disabled']['#value'] = array();

in content_admin_field_overview_form somewhere before

foreach ($dummy_form as $key => $value) {

be a better fix than casting an array ?

jillelaine’s picture

okay, i tested both KarenS and yched's fix for this issue: they both apparently work. Which one is the best? ;-)

here is what i put in the CCK content_admin.inc on the line above "foreach ($dummy_form as $key => $value) {"

 $form['disabled']['#value'] = array();

so that it reads

// fix for in_array watchdog error http://drupal.org/node/104229
  $form['disabled']['#value'] = array();
  
  foreach ($dummy_form as $key => $value) {

if you tell me which one is the 'best' fix, i'll create a patch! thanks for the code, y'all.

yched’s picture

Status: Active » Fixed

I went ahead and committed the fix in #9
fago proposed a similar (?) fix in http://drupal.org/node/108914, which was a duplicate

Anonymous’s picture

Status: Fixed » Closed (fixed)