upgrading from 1.9 to1.10 gave me the following error:

warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in /home/example/public_html/logos/sites/all/modules/nodewords/nodewords.module on line 933.

any thoughts?

regards,
Luciano

Comments

kmillecam’s picture

I'm getting the same error.

array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in /srv/drupal/htdocs/communities/sites/all/modules/nodewords/nodewords.module on line 933.

KerrySanto’s picture

Version: 5.x-1.9 » 5.x-1.10

yep am getting the same error also, it has something to do with the views module but I am not entirely sure what to fix as the line 933 is part of this

929 if (module_exists('views')) {
930 static $views_urls;
931 // Get all urls from views cache.
932 if (!is_array($views_urls)) {
933 $views_urls = array_flip(views_get_all_urls());
}

kbahey’s picture

Same error when I upgraded a site to 5.x-1.10.

Perhaps the views_get_all_urls() is not returning a simple two dimension array, but rather an array of arrays, and that is why array_flip() is erroring out.

As a temporary measure I just changed this:

    if (!is_array($views_urls)) {
      $views_urls = array_flip(views_get_all_urls());
    }

To this:

    if (!is_array($views_urls)) {
      @$views_urls = array_flip(views_get_all_urls());
    }

This only hushes the message, until we get a real fix.

Robrecht Jacques’s picture

Status: Active » Postponed (maintainer needs more info)

Can someone who gets this error tell me what views_get_all_urls() returns on their site?

For example: install devel module, enable the "Execute php" block and insert into it:

dpm(views_get_all_urls());

Alternatively (also with devel module installed), edit nodewords.module and add

dpm(views_get_all_urls());

before

$views_urls = array_flip(views_get_all_urls());

After doing this you get a message like (if you go to admin for example):

Array
(
    [frontpage] => frontpage
    [tracker] => tracker
)

Paste that code here.

Thanks.

Can you also tell me which version of views module you use?

I can't seem to be able to reproduce and looking at the code in views_get_all_urls() it does return a simple string => string array so I'm not sure what is going on.

siliconmeadow’s picture

Hi,

Here are my results:

Array
(
    [frontpage] => frontpage
    [image_gallery] => 
    [image_latest] => image/recent
    [tracker] => tracker
)

Running:

  • Views 5.x-1.6
  • Drupal 5.10
  • PHP 4.4.8

The error seems to be appearing on every page but the front page.

Since the 'image_gallery' didn't have a value assigned, I disabled that view and the problem disappeared. Perhaps it's not dealing with nulls properly?

HTH,

Richard

Robrecht Jacques’s picture

Status: Postponed (maintainer needs more info) » Fixed

Thanks a lot. This seems to be a bug in image-2.0-alpha2 - the moment I enable that version of image module, I get the exact same bug. This is due to the fact that a view it defines ("image_gallery" from the image_gallery contrib module) has no URL defined, so this is set to NULL and then the array_flip() indeed fails.

A view that provides a page but not sets the URL is an error - I'll report this to the image_gallery maintainers.

I've fixed this in 5.x-1.11 released shortly by removing empty and NULL urls.

Thanks for the feedback siliconmeadow!

siliconmeadow’s picture

My pleasure!

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

joachim’s picture

Status: Closed (fixed) » Active

It's possible for page views in D5 to not specify a path. For example, they may be views that are meant to be used as embedded views. This is the case with the image gallery view.
The patch on image_gallery needs to be rolled back as it broke galleries. I could set a fake path on that view, but I think a better fix would be for nodewords to run its array through an array_filter().
Reopening.

Robrecht Jacques’s picture

Status: Active » Fixed

This has been fixed in nodewords:

I've fixed this in 5.x-1.11 released shortly by removing empty and NULL urls.

When you create a page view in D5 the description says:

Enter the URL to use for this view in the form of 'dir/dir'. Do not begin or end the URL with a /. Example: 'view/tracker'. This is required if providing a page view. (...)

This may have changed in later views versions or is not a real requirement (so the docs are wrong).

Whether image_gallery fixes that or not is no longer a concern to nodewords.

So reclosing it as "fixed" because if is fixed by using an array_filter() in nodewords.

joachim’s picture

Ah, sorry -- I didn't read all the comments properly!

Status: Fixed » Closed (fixed)

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