News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

2.0.17: undefined variable in english language pack, new.gif shows broken image

Started by CrankyOldguy, January 16, 2021, 10:59:15 PM

Previous topic - Next topic

CrankyOldguy

Realistically, this may be related to our upgrade, but when we recently upgraded from 1.x to 2.0.17 the *new* GIF indicating new posts in the forum was showing a broken image.  A quick look at the URL spotted it: .../Themes/NightBreeze20/images//new.gif

Backtracking through the theme, the broken variable was @settings['lang_images_url'], set in load.php at line 1779,
$settings['lang_images_url'] = $settings['images_url'] . '/' . (!empty($txt['image_lang']) ? $txt['image_lang'] : $user_info['language']);

I did a global search of the 2.0.17 installation files and didn't find 'image_lang' set anywhere, so the quick fix was to add
$txt['image_lang'] = 'english'; at line 14 of /Themes/default/languages/index.english.php

The core & default themes should have the same broken *new* GIF on a fresh 2.0.17 install, as they have the same chunks of code as the theme we're using.

Sir Osis of Liver

Haven't seen this in any 2.0.17 install, and have done several customizations with Nightbreeze and not seen it there, either.  How did you upgrade from 1.1 to 2.0.17?
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Aleksi "Lex" Kilpinen

Slava
Ukraini!


"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

CrankyOldguy

I'll go in reverse order: yes, the default theme was effected.

I suspect they did a Large Upgrade, but they had problems as it took them 4 or 5 days.  The forum had been running since 2006 or so, and had lots of additions and deletions.  The Ultimate Profile mod meant that nearly all installed packages needed to be manually inserted.  I don't know how they managed to remove Ultimate Profile before the upgrade, as it was dug in like a tick.

Reminder that I mentioned above: I thoroughly searched the 'full install' file set, and didn't find any hits on image_lang in any file except for one line in load.php.  I checked all file types for that image_lang string.  If it's there, it's inside a compressed file and the search couldn't see it.  I don't know how far back it extends as there aren't any old versions for download that I could find.

Sir Osis of Liver

Don't think it's a bug, more likely something broke in upgrade.  Clean set of 2.0.17 files should fix it.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

shawnb61

That image_lang is missing is not a concern - I suspect it is a holdover from prior versions, where there were often language-specific images that needed to be loaded...  We don't really do that anymore.  I think it's there in case you have an old theme that still uses .gifs for text.

However, that there is no language for the user in $user_info is a problem (look further to the right on that line...).  It is supposed to fall back to that user's language.

I would double-check language installs, etc.  If you are utf8, make sure you download the utf8 language pack(s). 

Double-check the forum's default language & all supported languages, & make sure you have those language packs loaded. 
Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Dzonny

Load.php:

// Make a special URL for the language.
$settings['lang_images_url'] = $settings['images_url'] . '/' . (!empty($txt['image_lang']) ? $txt['image_lang'] : $user_info['language']);

I guess that's where the text string is pulled from though.
It's from the latest github 2.0. build.

shawnb61

Quote from: Dzonny on January 18, 2021, 09:24:16 AM
I guess that's where the text string is pulled from though.

Only if it exists (the !empty terniary - is an if-?-then-:-else).  If it doesn't exist, it pulls from the user language, $user_info['language']. 

For it to be missing, it must be missing in BOTH places.  It still seems to me something is amiss with language selection/install.

I wouldn't worry about the image_lang - I suspect it's still there in case folks still use language-dependent .gifs in themes.  (In that case, the theme must provide the language & translations...)

Address the process rather than the outcome.  Then, the outcome becomes more likely.   - Fripp

Dzonny

Yeah, i know, I just wasn't sure why we even need it as it's removed from the default theme, but it makes sense to leave it for other themes which still has language-dependent gifs.

Advertisement: