Closed (fixed)
Project:
File Picker
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
18 Jun 2013 at 19:39 UTC
Updated:
3 Jul 2013 at 12:10 UTC
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
Comment #1
hutch commentedThese 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.
Comment #2
weboide commentedThe conflict is gone with the latest 7.x-1.x git commit! :)
Thank you!
Comment #3
hutch commentedOK, marked as fixed
Comment #4.0
(not verified) commentedadded note about also applying to imagepicker.