Hi there,
when printing a view, as described here (#1 - user-type view)...
-> How to setup a "Who's bookmarked this" tab
... I get these errors:
warning: array_fill() [function.array-fill]: Number of elements must be positive in /includes/database.inc on line 241.
warning: implode() [function.implode]: Bad arguments. in /includes/database.inc on line 241.
warning: array_keys() [function.array-keys]: The first argument should be an array in /user/user.module on line 502.
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 query: SELECT p.perm FROM role r INNER JOIN permission p ON p.rid = r.rid WHERE r.rid IN () in /user/user.module on line 502.
Is it a Flag's or Views' issue?
Tia,
szy.
Comments
Comment #1
szy commentedThis is my view, causing the errors.
Szy.
Comment #2
szy commentedNow I see that errors disappear when I remove user's picture field. Hm?
Szy.
Comment #3
szy commentedHello,
I'm moving this issue from Flag's queue to Drupal User's issues. I assume it's
a user.module's behaviour problem - feel free to move it if I'm wrong...
Tia for your help,
Szy.
Comment #4
szy commentedComment #5
szy commentedI still get this error using code from #368644: Get users who flagged a node, first comment.
I'm moving this issue back to Flag's queue.
Szy.
Comment #6
quicksketchI can import your view and it seems to work fine. At least I can't reproduce the problem that you're describing. This may be similar to your other issue, #380914: Get both anonymous and logged in users who flagged a node..., which I've looked a little bit into also. The problem with both this and the other issue may be that the Anonymous user is not in the database. Since there is no anonymous user in the database (in the "users" table) the user information can never be loaded.
The segment of code your describing comes from the user_access() function. Which I'm guessing that something is trying to check permissions against an anonymous user. However, since the anonymous user isn't in the database there's no way that Drupal can load it or check permissions against it.
It seems that this will be a further limitation of our anonymous flagging: we can't list them at all. However, that doesn't mean that Flag shouldn't automatically prevent such errors from happening, even if we can't list anonymous users. However, the trouble is that I can't get the same error you are getting.
Comment #7
mooffie commentedSzymon, you should find out why user_access() is called in the first place. One way to do this is to add the following before line 502:
(The code may have typos.)
Comment #8
mitchell commentedComment #9
danfinney commentedI received the same error message after approving a spammy looking comment. (I moderate comments.)
Comment #10
rajo commentedI received this message after enabling Gravatar module :(
Comment #11
daengo commentedI get this same error when I try to enable the path module.
user warning: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1 query: SELECT p.perm FROM role r INNER JOIN permission p ON p.rid = r.rid WHERE r.rid IN () in /THE_PATH/modules/user/user.module on line 502.
Comment #12
quicksketchI'm closing this issue since it's not an actual bug in Flag module (unless you apply the unfinished patch in #271582: Allow anonymous users to flag content). Please do not reopen this issue unless experiencing the issue with an official release of Flag module.
Comment #13
Nathan1979 commentedI had the same error but fixed it:
I found the cause within the user.module @ function user_access($string, $account = NULL, $reset = FALSE) line 482.
This function recieved a second agument ($account) as also a permission string instead of a user object. Therefor the user roles could not be found, resulting in this error.
Tracing down the caller of this script i found in includes/menu.inc @ function _menu_check_access(&$item, $map) line 436
that this script was called with 2 arguments cause $item['access_arguments'] hold 2 arguments, should be 1!! (unles the second argument is a userobject).
Solution:
use print_r to print $map and $arguments. now notice that somewhere $arguments holds 2 permissions within the array. The $map corresponding to this $arguments tells us the routerpath.
The actual problem is situated within the 'menu_router' table, field access_arguments. Find the correct routerpath and edit the serialized array for field access_arguments so it holds only 1 key=>value.
This worked for me, hope it helps you to fix your problems...
Comment #14
kakajoe commentedhi nathan...would you care to give us a snippet for you trick?? so a newbie like me can understand...thanks
Comment #15
James Marks commentedSeems like adding a test in user_access to make sure that $account->roles is an array before treating it as an array might be a good idea (http://api.drupal.org/api/function/user_access/6#comment-1513), not as a core-hack but as a core improvement. Otherwise, it will be necessary to track down every call that provides incompatible parameters (and there seem to be a number of them in various contrib modules).
Comment #16
scuba_flyOld topic, but it helped me out :)
Nathan1979 said something about access_arguments having 2 arguments
that was exacly the case in my code.
I had a hook_menu implementation:
changed the line:
to:
And now it works fine. Hope this helps anyone who was googling for this as i was.