Hi.

Today I updated the Administration Language module to its newest version (7.x-1.0-beta2). After that, my web site's watch dog system began to log lots of messages about a PHP notice, that apparently take place for every page that is visited in my web site.

The message is the following:
Notice: Undefined variable: language in admin_language_language_init() (line 729 of /home/mywebsite/public_html/sites/all/modules/admin_language/admin_language.module).

Is this a bug that has been introduced in this new version of the module? Or am I doing something wrong?

Many thanks in advance! :)
Reis Quarteu

Comments

Reis Quarteu created an issue. See original summary.

jcnventura’s picture

Confirmed. This last update broke the module for me.. I've reverted to beta1, since I can't get the site to use the defined admin language because of the above error.

hassebasse’s picture

Same happend to me.

Having this message on the site (but not in admin mode)

Notice: Undefined variable: language in admin_language_language_init() (line 729 of /home/site_name/public_html/sites/all/modules/admin_language/admin_language.module).

vistree’s picture

Same problem here!

pepe roni’s picture

I can confirm #3 and reverted to prior version (beta1) as in #2.

But I must say, there are nice new features in the beta2 ;)

ramdas gaikar’s picture

Status: Active » Needs review
StatusFileSize
new418 bytes

The Variable language is unnecessarily used in the code.

I have removed that from code.

Please find the patch will.

Hope it will resolve the issue.

Thanks.

reis quarteu’s picture

Issue summary: View changes
reis quarteu’s picture

I confirm that patch #6 works and gets rid of the log messages. Many Thanks for your kind help, @Ramdas! :)

I also confirm what is written in #3: the log messages don't occur in admin mode. Thanks for your point, @hassebasse! :)

I just wonder if the patch will not affect some functionality of the module.

Best regards!

mohammed76’s picture

when will we see this patch in a dev version? I even vote for a third beta since this bug broke the functionality for all users.

vistree’s picture

For me the backend is still not switched. Instead, the current language is set. Tested as admin user right now

danielmrichards’s picture

The issue here is being caused during this modules implementation of hook_init. On line 729 and 726 it is attempting to use drupals global $language variable, without actually instantiating it.

So this little patch should get things working again.

fox_01’s picture

#11 works for me. the errors are gone

vistree’s picture

#11 solves the problem on admin pages. Admin language is used there now!

nssdcg’s picture

I don´t have enough knowledge to apply the patch (tried to read the Drupal guide for doing it but it might as well be in chinese) could you please just tell me what lines of code need to be changed?

Steff Vanhaverbeke’s picture

@nssdcg

To patch a file:
1) Download the patch file [nameofthepatchfile.patch]
2) Place it in the same directory as the file you'd like to patch. In this case 'admin_language.module'
3) Using a unix/linux command shell, type after the $ sign:

patch < [nameofthepatchfile.patch]

If you don't use unix or linux, see https://www.drupal.org/patch/apply

AsadKamil’s picture

admin_language-undefined_variable_language-2768897-11.patch, This patch is applied cleanly to 7.x branch
Thanks.

root@asad-Vostro-3550:/var/www/html/git/admin_language# git apply -v admin_language-undefined_variable_language-2768897-11.patch 
Checking patch admin_language.module...
Applied patch admin_language.module cleanly.
root@asad-Vostro-3550:/var/www/html/git/admin_language# 
mohammed76’s picture

Status: Needs review » Reviewed & tested by the community

Just to confirm, patch in #11 worked for me too.

adrien.felipe’s picture

#11 works for me too. Thanks.

stefan.r’s picture

Priority: Normal » Critical
stefan.r’s picture

Status: Reviewed & tested by the community » Fixed

beta2 was indeed completely broken! Committing this and will tag this as beta3.

Status: Fixed » Closed (fixed)

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