Background:

I have content type called 'products'. There is a view that filters and displays 'products'. When clicking on a specific 'products', we are taken to it's corresponding content page. This page utilizes one display from the 'products-view' (uses contextual filters) and another from a 'application-view' - both as blocks on the side. The output on the content page (to the right of the two blocks) is generated from a custom node.tpl file, which just displays the body field of the content 'products'.

I am using xampp 1.7.7:

Apache/2.2.21 (Win32)
mod_ssl/2.2.21
OpenSSL/1.0.0e
PHP/5.3.8 mod_perl/2.0.4 Perl/v5.10.1
MySQL client version: mysqlnd 5.0.8-dev - 20102224 - $Revision: 310735 $

I've also have done a major upgrade - from Drupal 6 to Drupal 7 (see my second attached file)

---

My error:

The following dpm() error (warning) is displayed on a specific 'products' page.

Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 179 of C:\mamp\public_html\test\includes\entity.inc).

---

Definition:

array_flip — Exchanges all keys with their associated values in an array

Short conclusion: Values of arrays need to either be 'string', or 'integer' type, otherwise, array_flip cannot perform.

Source: http://php.net/manual/en/function.array-flip.php

---

Debugging

I'm using XDebug and NetBeans to debug. I opened 'entity.inc', and placed a 'breakpoint' at the lines:

$passed_ids = !empty($ids) ? array_flip($ids) : FALSE;

After beginning the 'Debug Project' (pressing 'F5'). I pressed 'Continue' on the NetBeans tool bar to succeed each iteration (see attached file)

---

Original post on drupal.org forum: https://drupal.org/node/1868754#comment-6861560

CommentFileSizeAuthor
#1 module-list.txt8.76 KBjmm42
backtrace.txt13.42 KBjmm42

Comments

jmm42’s picture

StatusFileSize
new8.76 KB
jmm42’s picture

Issue summary: View changes

Webserver information

catch’s picture

Category: bug » support
Status: Active » Postponed (maintainer needs more info)

This happens if invalid data gets passed to entity_load(). It's not a bug in that function (and hence not a core bug), it means it was passed bad data.

Rather than posting every backtrace from entity_load(), you'd be better off adding some debug from when the array is invalid then trying to work out where that came from (usually it's a NULL or FALSE as the array value).

jmm42’s picture

array_flip() expects data to be either string or integer. But, as we can see from 'iteration 5' of the backtrace, we have an array value instead of string or integer. This causes array_flip() to choke.

Fifth Iteration

Variables:
ids: array[1]
[0] array[10]
[filename] string "core.jpg"
[filepath] string "sites/default/files/imagefield_default_images/core.jpg"
[filemime] string "image/jpeg"
[source] string "default_image_upload"
[destination] string "sites/default/files/imagefield_default_images/core.jpg"
[filesize] integer "5620"
[uid] string "1"
[status] integer 1

How do I add a debug if array_flip() takes a bad value, in our case, an array (as shown above)?
[timestamp] integer 1340815115
[fid] boolean 0

catch’s picture

Oh that'll do, I couldn't see it just scanning through. Looks like #850946: Warning after enabling Insert: Warning: array_flip(): Can only flip STRING and INTEGER values! or similar.

jmm42’s picture

Do you think the error is being generated because my entity uses an image field - and, hence why you claim it to be similar to the link you provided?

jmm42’s picture

I'm looking at my new upgraded Drupal 7 '[site:name]/admin/modules', and it still has submodules stuck in Drupal 6 - which used to be part of CCK:

  • Email
  • FileField
  • FileField Meta
  • ImageField

I am not able to uninstall these submodules, nor delete them from the directory:

[site:name]/sites/all/modules

since CCK is now part of core. I needed CCK to complete upgrade paths from D6 to D7 during my upgrade. Do you think this may be the issue? If so, how do I remove these submodules, which I cannot uninstall and no located in the modules directory: '[site:name]/admin/modules'?

jmm42’s picture

Not sure if this provides any more insightful information. But, the error I was receiving on '[site:name]/products/sample', also exists on:

[site:name]:admin/structure/types/manage/product/fields/field_product_contrib_photo

The above is an image field for my 'products' content type. If however, i goto another content of the same type 'products':

'[site:name]products/sample2', I receive no errors. Now I'm beginning to wonder if it has to do with contextual filters, or views?

jmm42’s picture

I resolved this issue, here it is:

http://drupal.org/node/1868754#comment-6862930

jmm42’s picture

Issue summary: View changes

Forgot to mention that I upgrade drupal 6 to drupal 7

webchick’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)

4 year old support request.