warning: in_array(): Wrong datatype for second argument in /home/hutigers/www/drupal/modules/img_assist/img_assist.module on line 76.

in a freebsd, PHP Version 4.3.10, mysql 3.23.49

Comments

picturesque’s picture

Same problem here. FreeBSD 4.7 Apache/1.3.33 (Unix) PHP/4.3.6 mySQL 3.23.58 w/ZendOptimizer

weaponx’s picture

Same error here.

Iam using Windows NT 5.1, Apache 1.3.23, PHP 4.3.8, mysql 3.23.49

matt westgate’s picture

While I couldn't reproduce the error myself, I think I did figure out the problem. Download a new copy of the module and reopen this issue if the problem still persists.

Anonymous’s picture

I believe this only happens when "Hide 'inline image link' for the following node types:*" has no items checked. In this case, the variable_get('img_assist_no_nodes', array()) on line 76 is returning 0. Not an array, just 0. Thus, in_array() fails.

As I've only been using Drupal for a couple of hours, I have no idea why this happens, but I've replaced line 76 with the following lines:
$tempArray = variable_get('img_assist_no_nodes', array());
if (!is_array($tempArray)) $tempArray = array();
if (img_assist_access() && !in_array($node->type, $tempArray)) {

Without having really tested, this seems to have fixed the problem. It has, at least, gotten rid of the error message. :)

matt westgate’s picture

Ah, the new release hasn't been generated yet! In this new version which should be automatically packaged up and available in an hour or so, I simply typecasted the result to an array. Your thinking is correct.

Anonymous’s picture