Filepicker should not have functions that are not hooks, but still named like hooks, even outside filepicker.module.

In another module, if you define hook_hook_info like so:

function mymodule_hook_info()
{
  return array(
    'user_view' => array(
      'group' => 'user',
    ),
  );
}

filepicker_user_view from filepicker.user.inc will be registered as a hook for hook_user_view.

This causes:
Recoverable fatal error: Object of class stdClass could not be converted to string in DatabaseStatementBase->execute() (line 2178 of /home/[...]/includes/database/database.inc).

The resulting stack trace (truncated for privacy) is:

#0  DatabaseStatementBase->execute(Array ([:db_condition_placeholder_0] => stdClass Object ([uid] => 4210, [...]
#1  DatabaseConnection->query(SELECT i.file_id AS file_id, i.uid AS uid, i.file_name AS file_name, i.file_title AS file_title, i.file_date AS file_date FROM {filepicker} i WHERE  (file_id = :db_condition_placeholder_0) LIMIT 1 OFFSET 0, Array ([:db_condition_placeholder_0] => stdClass Object ([uid] => 4210, [...]
#2  SelectQuery->execute() called at [/home/[...]/sites/all/modules/filepicker/filepicker.functions.inc:1416]
#3  _filepicker_get_file(stdClass Object ([uid] => 4210, [...]
#4  filepicker_user_view(stdClass Object ([uid] => 4210, [...]
#5  call_user_func_array(filepicker_user_view, Array ([1] => stdClass Object ([uid] => 4210  [...]
#6  module_invoke_all(user_view, stdClass Object ([uid] => 4210, [...]
#7  user_build_content(stdClass Object ([uid] => 4210, [...]
#8  user_view(stdClass Object ([uid] => 4210, [...]
#9  user_view_page(stdClass Object ([uid] => 4210, [...]
#10 call_user_func_array(user_view_page, Array ([0] => stdClass Object ([uid] => 4210, [...]
#11 menu_execute_active_handler() called at [/home/[...]/index.php:21]

I'm using filepicker 7.x-1.4+11-dev

This appears to also apply to imagepicker.

Comments

hutch’s picture

Status: Active » Needs review

These function names hark back to a time before the advent of Views or hooks for that matter, I have commited fixes that eliminate function names ending in "_view" in Filepicker and Imagepicker for D7
Thank you for reporting this, please check that this fixes your use case.

weboide’s picture

Status: Needs review » Reviewed & tested by the community

The conflict is gone with the latest 7.x-1.x git commit! :)
Thank you!

hutch’s picture

Status: Reviewed & tested by the community » Fixed

OK, marked as fixed

Status: Fixed » Closed (fixed)

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

Anonymous’s picture

Issue summary: View changes

added note about also applying to imagepicker.