warning: strtr() expects parameter 1 to be string, array given in [...]/includes/common.inc on line 946.

The error occurs on PHP 5.3 when visiting user/registrer

Here's an excerpt from the backtrace:

[16] => Array
        (
            [function] => accountmenu_translated_menu_link_alter
            [args] => Array
                (
                    [0] => Array
                        (
                            [load_functions] => Array
                                (
                                    [1] => user_uid_optional_load
                                )

                            [to_arg_functions] => a:1:{i:1;s:24:"user_uid_optional_to_arg";}
                            [access_callback] => user_view_access
                            [access_arguments] => a:1:{i:0;i:1;}
                            [page_callback] => realname_user_view
                            [page_arguments] => a:1:{i:0;i:1;}
                            [title] => My account
                            [title_callback] => realname_user_page_title
                            [title_arguments] => a:1:{i:0;i:1;}
                            [type] => 6
                            [description] => 
                            [menu_name] => accountmenu
                            [mlid] => 1504
                            [plid] => 0
                            [link_path] => user/%
                            [router_path] => user/%
                            [link_title] => My account
                            [options] => Array
                                (
                                    [alter] => 1
                                    [attributes] => Array
                                        (
                                            [title] => View/edit user account.
                                        )

                                    [accountmenu_link_title] => My account
                                )

                            [module] => accountmenu
                            [hidden] => 0
                            [external] => 0
                            [has_children] => 0
                            [expanded] => 0
                            [weight] => 0
                            [depth] => 1
                            [customized] => 0
                            [p1] => 1504
                            [p2] => 0
                            [p3] => 0
                            [p4] => 0
                            [p5] => 0
                            [p6] => 0
                            [p7] => 0
                            [p8] => 0
                            [p9] => 0
                            [updated] => 0
                            [in_active_trail] => 
                            [href] => user/0
                            [access] => 
                        )

                    [1] => Array
                        (
                            [0] => user
                            [1] => stdClass Object
                                (
                                    [uid] => 0
                                    [name] => 
                                    [pass] => 
                                    [mail] => 
                                    [mode] => 0
                                    [sort] => 0
                                    [threshold] => 0
                                    [theme] => 
                                    [signature] => 
                                    [signature_format] => 0
                                    [created] => 0
                                    [access] => 0
                                    [login] => 0
                                    [status] => 0
                                    [timezone] => 
                                    [language] => 
                                    [picture] => 
                                    [init] => 
                                    [data] => 
                                    [timezone_name] => 
                                    [roles] => Array
                                        (
                                            [1] => anonymous user
                                        )

                                    [realname] => 
                                )

                        )

                )

        )

    [17] => Array
        (
            [file] => [...]/sites/all/modules/accountmenu/accountmenu.module
            [line] => 162
            [function] => t
            [args] => Array
                (
                    [0] => 
                    [1] => Array
                        (
                            [@name] => 
                            [@realname] => 
                            [!name] => 
                            [!realname] => 
                        )

                )

        )

    [18] => Array
        (
            [file] => [...]/includes/common.inc
            [line] => 946
            [function] => strtr
            [args] => Array
                (

Comments

anrikun’s picture

Actually it happens on almost all the pages.

mattyoung’s picture

Looks like you were accessing the page as "anonymous user", but the error is in processing the "My account" menu. This doesn't make sense. This menu should not be accessible by the anonymous user.

Can you confirm if you were logged in or not?

What happen if you go to path /user?

mattyoung’s picture

Status: Active » Closed (cannot reproduce)

Closed because got no feedback

Anonymous’s picture

Status: Closed (cannot reproduce) » Active

I'm getting same error, my dblog is full of this error.

common.inc file 945. line strtr() expects parameter 1 to be string, array given.

mattyoung’s picture

The problem should be fixed in the May-20 dev version. Give that a try. If the problem is gone, I'll make a release.

Anonymous’s picture

Thank you, that solved my problem.

Guty’s picture

Thank you. This also solved my issue with "strtr() expects parameter 1 to be string, array given in [...]/includes/common.inc on line 944".

Google is able to find lots of pages with turned on error messages if you are googling for '/includes/common.inc on line 944'.

The only way to trigger this error on my page is to switch from English to another language with a user which has role guest.

PvO’s picture

Pfffff finally someone pointed me to this issue. Installation of dev version solved my problem with strtr().

roball’s picture

Title: Error on PHP 5.3 » PHP 5.3 error "strtr() expects parameter 1 to be string, array given in .../includes/common.inc"
Version: 6.x-1.x-dev » 6.x-1.8

With Drupal 6.24 the error message is

strtr() expects parameter 1 to be string, array given in /usr/share/drupal6/includes/common.inc on line 976.
roball’s picture

Can confirm that the 6.x-1.x-dev (2011-May-21) version fixes that annoying problem of having the dblog bloated with the error messages mentioned above. Please release 6.x-1.9, as promised on 22 May 2011, thanks.

mattyoung’s picture

Okay, I made a new release fixing this problem. Sorry about the delay. I'm on a spiritual journey right now deep inside Mt. Emei Sichuan, China. Only have sporadic network access.

If there is any problem with this release, please re-open this issue.

Also, is there anyone can help me co-maintain and upgrade this module while i'm out on this "wild goose chase"?

roball’s picture

Version: 6.x-1.8 » 6.x-1.9
Status: Active » Fixed

Thanks a lot for the release - it's working fine. And gain much spirit!

Status: Fixed » Closed (fixed)

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

Jevedor’s picture

I don't know if something has changed but I am running 6.24 on a php5.3 local installation. This error has reappeared. Did a recent Drupal core update remove this old fix?

Jevedor’s picture

Disregard. I am running an old version of pathauto.