Deleting nodes makes orphan records I have a content type "event" which has an image field.
I tried to deleted the nodes, but I got the repeated errors when deleted the nodes.


  
    Warning: array_flip(): Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->load() (line 178 of D:\xampp\htdocs\mysite\includes\entity.inc).
  


I did not use any hook to delete nodes. I just deleted the nodes from the page "admin/content" by selecting "Delete selected nodes" in the UPDATE OPTIONS.

I checked the node related tables including field tables and I found that they were deleted as expected. When I tried to query the file tables, I found that some records were not deleted and the files in the file directory were not deleted too.

BEFORE DELETE

mysql&gt; select * from file_usage where id = 41 order by fid;
+--+--+--+--+--+--+--+--+--+--+--+--+--++
| fid | module      | type | id | count |
+--+--+--+--+--+--+--+--+--+--+--+--+--++
| 30  | file        | node | 41 | 1     |
| 31  | file        | node | 41 | 1     |
| 32  | file        | node | 41 | 1     |
| 172 | file        | node | 41 | 1     |
+--+--+--+--+--+--+--+--+--+--+--+--+--++

mysql&gt; select fid, filename, uri from file_managed where fid in (30,31,32,172);
+-----+------------------------------------+-----------------------------------------------+
| fid    | filename                        | uri                                           |
+-----+------------------------------------+-----------------------------------------------+
|    30  | Festival.jpg                    | public://Festival_0.jpg                       |
|    31  | Festival.jpg                    | public://Festival_1.jpg                       |
|    32  | Festival.jpg                    | public://Festival_2.jpg                       |
|    172 | Festival_465x350.jpg            | public://Festival_465x350_0.jpg               |
+-----+------------------------------------+-----------------------------------------------+


AFTER DELETE

mysql&gt; select count(*) from node where type = 'event';
+----------+
| count(*) |
+----------+
| 0        |
+----------+

mysql&gt; select * from file_usage where id = 41 order by fid;
+--+--+--+--+--+
| fid | module | type | id | count |
+--+--+--+--+--+
| 30 | file | node | 41 | 1 |
| 31 | file | node | 41 | 1 |
| 32 | file | node | 41 | 1 |
+--+--+--+--+--+

mysql&gt; select fid, filename, uri from file_managed where fid in (30,31,32);
+-----+---------------------+-------------------------------+
| fid    | filename         | uri                           |
+-----+---------------------+-------------------------------+
|    30  | Festival.jpg     | public://Festival_0.jpg       |
|    31  | Festival.jpg     | public://Festival_1.jpg       |
|    32  | Festival.jpg     | public://Festival_2.jpg       |
+-----+------------------------------------+----------------+


They became orphan. What could that be why they are not deleted as expected?
Is there any fix for this? 
My Drupal version is 7.15.
Incidentally, I got this error yesterday ;-) And after a bit of searching and looking into the documentation, I found that the cause was the functions which loads entities in Drupal and with the name like something_load(e.g. node_load()). I was using node_load() function to load the node and then delete it using node_delete_multiple().

This error was caused because, I was passing array as an argument to node_load(), by something like user_load(array("...; which is not the right way to do it.
The argument to anything_load() function must be a single id. So, you can search for the _load functions which uses array as an argument in your code.