Closed (outdated)
Project:
Token
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
14 Jan 2011 at 12:30 UTC
Updated:
24 Apr 2024 at 18:37 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
hass commentedHm... is $user->roles not an array? Normally you cannot have no roles... or I thought so. Logged in user or Anonymous?
Comment #2
hass commentedI have no clue how you are able to get this warning. If you are logged in, you MUST have at least a role "authenticated user" plus some others and if you are logged out a role "anonymous user". Please write a repro plan.
Comment #3
jannalexx commentedOf course there are roles, message only on logged in users, when logging in and when creating or updating content as tested . Unfortunatelly reproduction is not possible but version 3.0 stable does not produce the error. There is a backtrace in case it can tell something
latest dev 17-01-11
a. logging-in
warning: implode() [function.implode]: Invalid arguments passed in .../google_analytics/googleanalytics.module on line 484.
Backtrace:
implode(a:2:{i:0;s:1:",";i:1;N;})[googleanalytics.module:484];
.googleanalytics_token_values(a:3:{i:0;s:4:"user";i:1;N;i:2;a:0:{}})[?:?];
..call_user_func_array(array)[module.inc:483];
...module_invoke_all(array)[token.module:336];
....token_get_values(a:3:{i:0;s:4:"user";i:1;N;i:2;b:1;})[user_stats.module:699];
.....user_stats_login_count_update(a:2:{i:0;s:9:"increment";i:1;s:2:"17";})[user_stats.module:441];
......user_stats_user(array)[user.module:22];
.......user_module_invoke(array)[user.module:1405];
........user_authenticate_finalize(array)[user.module:1378];
.........user_authenticate(array)[user.module:1338];
..........user_login_authenticate_validate(array)[form.inc:780];
...........form_execute_handlers(array)[form.inc:725];
............_form_validate(array)[form.inc:590];
.............drupal_validate_form(array)[form.inc:409];
..............drupal_process_form(array)[form.inc:119];
...............drupal_get_form(a:1:{i:0;s:16:"user_login_block";})[user.module:742];
................user_block(a:2:{i:0;s:4:"view";i:1;s:1:"0";})[?:?];
.................call_user_func_array(array)[module.inc:462];
..................module_invoke(array)[block.module:509];
...................block_list(a:1:{i:0;s:15:"sidebar_outside";})[theme.inc:1626];
....................theme_blocks(a:1:{i:0;s:15:"sidebar_outside";})[?:?];
.....................call_user_func_array(array)[theme.inc:656];
......................theme(array)[theme.inc:1820];
.......................template_preprocess_page(array)[?:?];
........................call_user_func_array(array)[theme.inc:697];
.........................theme(array)[index.php:52];
..........................index.php
warning: array_keys() [function.array-keys]: The first argument should be an array in .../google_analytics/googleanalytics.module on line 485.
Backtrace:
array_keys(a:1:{i:0;N;})[googleanalytics.module:485];
.googleanalytics_token_values(a:3:{i:0;s:4:"user";i:1;N;i:2;a:0:{}})[?:?];
..call_user_func_array(array)[module.inc:483];
...module_invoke_all(array)[token.module:336];
....token_get_values(a:3:{i:0;s:4:"user";i:1;N;i:2;b:1;})[user_stats.module:699];
.....user_stats_login_count_update(a:2:{i:0;s:9:"increment";i:1;s:2:"17";})[user_stats.module:441];
......user_stats_user(array)[user.module:22];
.......user_module_invoke(array)[user.module:1405];
........user_authenticate_finalize(array)[user.module:1378];
.........user_authenticate(array)[user.module:1338];
..........user_login_authenticate_validate(array)[form.inc:780];
...........form_execute_handlers(array)[form.inc:725];
............_form_validate(array)[form.inc:590];
.............drupal_validate_form(array)[form.inc:409];
..............drupal_process_form(array)[form.inc:119];
...............drupal_get_form(a:1:{i:0;s:16:"user_login_block";})[user.module:742];
................user_block(a:2:{i:0;s:4:"view";i:1;s:1:"0";})[?:?];
.................call_user_func_array(array)[module.inc:462];
..................module_invoke(array)[block.module:509];
...................block_list(a:1:{i:0;s:15:"sidebar_outside";})[theme.inc:1626];
....................theme_blocks(a:1:{i:0;s:15:"sidebar_outside";})[?:?];
.....................call_user_func_array(array)[theme.inc:656];
......................theme(array)[theme.inc:1820];
.......................template_preprocess_page(array)[?:?];
........................call_user_func_array(array)[theme.inc:697];
.........................theme(array)[index.php:52];
..........................index.php
warning: implode() [function.implode]: Invalid arguments passed in ...google_analytics/googleanalytics.module on line 485.
Backtrace:
implode(a:2:{i:0;s:1:",";i:1;N;})[googleanalytics.module:485];
.googleanalytics_token_values(a:3:{i:0;s:4:"user";i:1;N;i:2;a:0:{}})[?:?];
..call_user_func_array(array)[module.inc:483];
...module_invoke_all(array)[token.module:336];
....token_get_values(a:3:{i:0;s:4:"user";i:1;N;i:2;b:1;})[user_stats.module:699];
.....user_stats_login_count_update(a:2:{i:0;s:9:"increment";i:1;s:2:"17";})[user_stats.module:441];
......user_stats_user(array)[user.module:22];
.......user_module_invoke(array)[user.module:1405];
........user_authenticate_finalize(array)[user.module:1378];
.........user_authenticate(array)[user.module:1338];
..........user_login_authenticate_validate(array)[form.inc:780];
...........form_execute_handlers(array)[form.inc:725];
............_form_validate(array)[form.inc:590];
.............drupal_validate_form(array)[form.inc:409];
..............drupal_process_form(array)[form.inc:119];
...............drupal_get_form(a:1:{i:0;s:16:"user_login_block";})[user.module:742];
................user_block(a:2:{i:0;s:4:"view";i:1;s:1:"0";})[?:?];
.................call_user_func_array(array)[module.inc:462];
..................module_invoke(array)[block.module:509];
...................block_list(a:1:{i:0;s:15:"sidebar_outside";})[theme.inc:1626];
....................theme_blocks(a:1:{i:0;s:15:"sidebar_outside";})[?:?];
.....................call_user_func_array(array)[theme.inc:656];
......................theme(array)[theme.inc:1820];
.......................template_preprocess_page(array)[?:?];
........................call_user_func_array(array)[theme.inc:697];
.........................theme(array)[index.php:52];
..........................index.php
b. content creation
warning: implode() [function.implode]: Invalid arguments passed in .../google_analytics/googleanalytics.module on line 484.
Backtrace:
implode(a:2:{i:0;s:1:",";i:1;N;})[googleanalytics.module:484];
.googleanalytics_token_values(a:3:{i:0;s:4:"user";i:1;N;i:2;a:0:{}})[?:?];
..call_user_func_array(array)[module.inc:483];
...module_invoke_all(array)[token.module:336];
....token_get_values(a:3:{i:0;s:4:"user";i:1;N;i:2;b:1;})[user_stats.module:781];
.....user_stats_post_count_update(a:2:{i:0;s:5:"reset";i:1;s:2:"17";})[user_stats.module:307];
......user_stats_nodeapi(array)[node.module:679];
.......node_invoke_nodeapi(array)[node.module:932];
........node_save(array)[node.pages.inc:456];
.........node_form_submit(array)[form.inc:780];
..........form_execute_handlers(array)[form.inc:260];
...........ctools_process_form(array)[form.inc:102];
............ctools_build_form(array)[node_edit_form.inc:75];
.............ctools_context_create_node_edit_form(array)[context.inc:564];
..............ctools_context_create(array)[node_edit.inc:37];
...............ctools_node_edit_context(array)[context.inc:757];
................ctools_context_get_context_from_argument(array)[context.inc:813];
.................ctools_context_get_context_from_arguments(array)[context-task-handler.inc:227];
..................ctools_context_handler_get_task_contexts(array)[node_edit.inc:92];
...................page_manager_node_edit(array)[?:?];
....................call_user_func_array(array)[menu.inc:348];
.....................menu_execute_active_handler(a:0:{})[index.php:34];
......................index.php
warning: array_keys() [function.array-keys]: The first argument should be an array in .../google_analytics/googleanalytics.module on line 485.
Backtrace:
array_keys(a:1:{i:0;N;})[googleanalytics.module:485];
.googleanalytics_token_values(a:3:{i:0;s:4:"user";i:1;N;i:2;a:0:{}})[?:?];
..call_user_func_array(array)[module.inc:483];
...module_invoke_all(array)[token.module:336];
....token_get_values(a:3:{i:0;s:4:"user";i:1;N;i:2;b:1;})[user_stats.module:781];
.....user_stats_post_count_update(a:2:{i:0;s:5:"reset";i:1;s:2:"17";})[user_stats.module:307];
......user_stats_nodeapi(array)[node.module:679];
.......node_invoke_nodeapi(array)[node.module:932];
........node_save(array)[node.pages.inc:456];
.........node_form_submit(array)[form.inc:780];
..........form_execute_handlers(array)[form.inc:260];
...........ctools_process_form(array)[form.inc:102];
............ctools_build_form(array)[node_edit_form.inc:75];
.............ctools_context_create_node_edit_form(array)[context.inc:564];
..............ctools_context_create(array)[node_edit.inc:37];
...............ctools_node_edit_context(array)[context.inc:757];
................ctools_context_get_context_from_argument(array)[context.inc:813];
.................ctools_context_get_context_from_arguments(array)[context-task-handler.inc:227];
..................ctools_context_handler_get_task_contexts(array)[node_edit.inc:92];
...................page_manager_node_edit(array)[?:?];
....................call_user_func_array(array)[menu.inc:348];
.....................menu_execute_active_handler(a:0:{})[index.php:34];
......................index.php
warning: implode() [function.implode]: Invalid arguments passed in ...google_analytics/googleanalytics.module on line 485.
Backtrace:
implode(a:2:{i:0;s:1:",";i:1;N;})[googleanalytics.module:485];
.googleanalytics_token_values(a:3:{i:0;s:4:"user";i:1;N;i:2;a:0:{}})[?:?];
..call_user_func_array(array)[module.inc:483];
...module_invoke_all(array)[token.module:336];
....token_get_values(a:3:{i:0;s:4:"user";i:1;N;i:2;b:1;})[user_stats.module:781];
.....user_stats_post_count_update(a:2:{i:0;s:5:"reset";i:1;s:2:"17";})[user_stats.module:307];
......user_stats_nodeapi(array)[node.module:679];
.......node_invoke_nodeapi(array)[node.module:932];
........node_save(array)[node.pages.inc:456];
.........node_form_submit(array)[form.inc:780];
..........form_execute_handlers(array)[form.inc:260];
...........ctools_process_form(array)[form.inc:102];
............ctools_build_form(array)[node_edit_form.inc:75];
.............ctools_context_create_node_edit_form(array)[context.inc:564];
..............ctools_context_create(array)[node_edit.inc:37];
...............ctools_node_edit_context(array)[context.inc:757];
................ctools_context_get_context_from_argument(array)[context.inc:813];
.................ctools_context_get_context_from_arguments(array)[context-task-handler.inc:227];
..................ctools_context_handler_get_task_contexts(array)[node_edit.inc:92];
...................page_manager_node_edit(array)[?:?];
....................call_user_func_array(array)[menu.inc:348];
.....................menu_execute_active_handler(a:0:{})[index.php:34];
......................index.php
Comment #4
jannalexx commentedlatest dev I have available that worked: googleanalytics.module,v 1.36.2.21 2010/10/09, I guess it points to token
something is wrong/conflict somewhere here
* Implementation of hook_token_values().
* Implementation of hook_token_list().
Comment #5
hass commentedToken support in custom variables will be a new feature in 6.x-3.1. Therefore you cannot see this issues in 3.0...
Here is a patch with some stolen code from token module. I hope this fixes the issue, but I was not yet able to repro it myself. Can you try this patch, please?
Comment #6
hass commentedComment #7
hass commentedCan you also test again with latest token dev (without my patch) first. I will take a look why token does not provide the user object. It may be a bug of token.
Comment #8
hass commentedComment #9
hass commentedThe more I'm thinking about this issue I believe this may be a bug in token. I've only implemented the hook as documented in the API, and if it's missing the object or it does not provide the full object than token module need to make sure that the object is available and not my hook. What this GA patch does is something that token module should do before it calls the hook with object user and not every single module that implements the token hook. This would be at least for performance reasons a worse idea.
The changed code is also not documented in token module and I do not have any clue why the below code is required.
Moving this issue to token queue where it hopefully get seen by Dave very soon.
Comment #10
hass commentedPatch attached for token. Fully untested prove of concept.
@jannalexx: Maybe you are able to give this patch a try, please?
Comment #12
jannalexx commentedboth pathces work, for #10 no error msgs on latest google analytics dev 3.x and token 1.15, i cannot say about other side effects, but the error has been disappeared
Comment #13
hass commentedMy token patch seems to have a side effect... hopefully one of the token maintainers can shed some light on this.
Comment #14
dave reidThis is a tough problem that fortunately we have solved in Drupal 7, but remains a sticky point for D6. Token module itself only defines the following three tokens as 'current user' tokens: [user-name], [user-id], and [user-mail]. There are no other current user tokens defined. All the other 'user' type tokens require a proper user object, which is up to the code calling token_replace() to provide itself. Now the kicker is that we're working around this in user_token_values(). Why? I do not know. It's not defined that those tokens should work for the global user, so we should probably just remove that hack.
Comment #15
xurizaemontoken_user.inc line 58 in that patch above,
$values['user-raw'] = !$account->uid && !$account->name ? : $account->name;Is that meant to be anonymous?
$values['user-raw'] = !$account->uid && !$account->name ? variable_get('anonymous', 'Anonymous') : $account->name;Comment #16
xurizaemon#14: 1026892-token-current-user-remove-hack.patch queued for re-testing.
Comment #17
dave reidUgh yeah, that's a bug in the patch.
Comment #18
xurizaemonIf my suggestion in #15 was the intended output, then here's the matching reroll.
(Presumably this got missed by the testbot because the tests don't ever trigger a load of token_user.inc.)
Comment #19
jwilson3Reroll of #18, which no longer applied against latest 6.x codebase. This definitely fixes the problems.
Comment #20
bluegeek9 commented