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
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | module-list.txt | 8.76 KB | jmm42 |
| backtrace.txt | 13.42 KB | jmm42 |
Comments
Comment #1
jmm42 commentedComment #1.0
jmm42 commentedWebserver information
Comment #2
catchThis 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).
Comment #3
jmm42 commentedarray_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
Comment #4
catchOh 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.
Comment #5
jmm42 commentedDo 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?
Comment #6
jmm42 commentedI'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:
I am not able to uninstall these submodules, nor delete them from the directory:
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'?
Comment #7
jmm42 commentedNot sure if this provides any more insightful information. But, the error I was receiving on '[site:name]/products/sample', also exists on:
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?
Comment #8
jmm42 commentedI resolved this issue, here it is:
http://drupal.org/node/1868754#comment-6862930
Comment #8.0
jmm42 commentedForgot to mention that I upgrade drupal 6 to drupal 7
Comment #9
webchick4 year old support request.