Wrong datatype for second argument in ... bio_views.inc

olio - November 9, 2007 - 11:30
Project:Bio
Version:5.x-1.2
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:closed
Description

Hi,
I just installed the actual dev version of bio, applied the patch "The first argument should be an array" and got another warning:
"Wrong datatype for second argument in ... bio_views.inc on line 111"

The fields mentioned further down in this warning are all cck text fields (2 x text, 1 x date). My modules are all up-to-date.
Thanks.

#1

kriskd - December 9, 2007 - 12:57

I'm getting the same errors too.

#2

Michelle - December 11, 2007 - 16:56

Me too in 1.1, not dev.

Michelle

#3

webchick - December 11, 2007 - 21:17
Priority:normal» critical

Well that's no good. ;P

#4

webchick - December 11, 2007 - 21:22
Version:5.x-1.x-dev» 5.x-1.1

Also moving to a more specific version number.

#5

Michelle - December 11, 2007 - 21:26

Some trouble shooting.

The first error is:

warning: array_keys() [function.array-keys]: The first argument should be an array in snip/sites/all/modules/bio/bio_views.inc on line 39. That's this bit:

<?php
 
// Fetch some CCK info if CCK is installed
 
if (module_exists('content')) {
   
$content_type_info = content_types($bio_type);
   
$bio_fields = array_keys($content_type_info['fields']); <-- 39
 
}
?>

And that's called from here:

<?php
function bio_views_tables_alter(&$tables) {
  require_once
drupal_get_path('module', 'bio') . '/bio_views.inc';
  return
_bio_views_tables_alter($tables);
}
?>

If I'm understanding correctly, this will only happen if both views and cck are enabled before bio.

Michelle

#6

grantkruger - December 21, 2007 - 23:37

That's the case with me too. Is there any workaround?

Here are my errors:

  • warning: array_keys() [function.array-keys]: The first argument should be an array in /mywebsitepath/drupal/sites/all/modules/bio/bio_views.inc on line 39.
  • warning: in_array() [function.in-array]: Wrong datatype for second argument in /mywebsitepath/drupal/sites/all/modules/bio/bio_views.inc on line 109.
  • warning: in_array() [function.in-array]: Wrong datatype for second argument in /mywebsitepath/drupal/sites/all/modules/bio/bio_views.inc on line 109.

#7

Mark Theunissen - January 24, 2008 - 13:17

Same problem here.

#8

webchick - January 28, 2008 - 08:55
Version:5.x-1.1» 5.x-1.2

Hm. I can't duplicate this. :(

Could you try against the newly created as of tonight 5.x-1.2 release?

#9

webchick - January 28, 2008 - 08:55

And if it's still a problem, can you please give me explicit, step-by-step instructions on how to reproduce?

#10

Mark Theunissen - January 28, 2008 - 09:51

Hi Angie

I've tried version 1.2 and I still get the barf... :(

I think these steps should reproduce:

1) Enable

- CCK 5.x-1.6-1
- Views 5.x-1.6

2) Make a view or two, not sure if that makes a difference.

3) Enable the Bio module

Error:

warning: in_array() [function.in-array]: Wrong datatype for second argument in bio_views.inc on line 137.

Sometimes there are many of these errors, sometimes just the one.

From looking at the code, I would say it's happening because $bio_fields has not been initialized to anything when it is passed to the in_array() function on line 137.

It's not being initialized because the CCK type for Bio is not created. This initialization happens on line 49.

Just a guess... ;)

Cheers
Mark

#11

Michelle - January 28, 2008 - 15:06

I'm having the same issue and I plan on doing a clean install of advprofile later today, which will hit the error again. I'll put in some debugging code and see if I can figure it out for you. If you look at #5, you can see that content_types($bio_type) isn't returning what it should. I'll dig in a bit to find out why.

Michelle

#12

webchick - January 28, 2008 - 20:42

From Michelle on IRC:

webchick - Ok, I did a clean install, and installed cck, views, and panels like I always do. This time I added devel into the mix so I could turn the backtrace on. Then I enabled bio. No errors. So either it was fixed in the latest dev (just grabbed a fresh tarball) or it's being a stinker. I'll let you know if the error pops up again as I'm sure I'll be repeating this process a lot.
Other than devel, this is the same process that has triggered the error the last 3 times I did it, so I'm thinking it's fixed

My test results were the same.

So I say again, can someone post stupidly explicit instructions on how to reproduce in 5.x-1.2?

#13

webchick - January 28, 2008 - 21:00
Status:active» needs review

Margh! Somehow in between uninstalling and trying a bunch of other things, I did manage to reproduce this once. But have no idea what I did and can't get it to do it again. :(

But could you try testing this patch, perhaps?

AttachmentSize
bio-views-error-190745-13.patch 1.54 KB

#14

webchick - January 28, 2008 - 21:02

And by "this patch," I actually meant this one. :P

AttachmentSize
bio-views-error-190745-14.patch 607 bytes

#15

Mark Theunissen - January 30, 2008 - 10:47

Hey Angie

I can confirm that the patch removes the error messages! No more barf..

Thanks for that
Mark

#16

ryo - January 30, 2008 - 17:28

The patch worked for me, too.

Thanks!

#17

webchick - January 30, 2008 - 19:11
Status:needs review» fixed

Ok, great. Committed. Will be part of the 5.x-1.3 release. Thanks for the tests!

#18

Anonymous (not verified) - February 13, 2008 - 19:11
Status:fixed» closed

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

#19

dugh - June 9, 2008 - 13:25

Can you go ahead and release 1.3.
This error still exists.

#20

darkpollo - July 12, 2008 - 11:37

I have got the same error.

#21

bonobo - August 9, 2008 - 22:08

Okay -- completely bizarre -- I saw this exact same error with bio 5.x-1.2.

Uninstalled bio (inlcuding the uninstall step at admin/build/modules/uninstall ) and then cleared the cache tables. Then, when I reinstalled bio, I saw no errors.

Same codebase, same db. The only changes I made were to disable the module at admin/build/modules; uninstall the module at admin/build/modules/uninstall, clear the cache* tables in the db, and then re-install the module. Poof! error gone.

#22

dugh - August 10, 2008 - 16:29
Status:closed» active

#23

Sven_S - September 15, 2008 - 18:49

# 22 :

Good idea! I did the same ... and it works ...

#24

henrrrik - September 25, 2008 - 10:40

# 22 :

So did I.

#25

bonobo - September 25, 2008 - 16:20
Status:active» fixed

Setting to fixed as this has been dormant for a while, and a documented workaround exists.

#26

Anonymous (not verified) - October 9, 2008 - 16:23
Status:fixed» closed

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

#27

radyaweb - December 5, 2008 - 03:28

Thanks the first patch worked for me.

The second patch is the same as the first patch, so if you already patch with the first one, you don't need to use the second one.

 
 

Drupal is a registered trademark of Dries Buytaert.