[fix] Not set or found: Array

Solutions for other advanced phplisters

[fix] Not set or found: Array

Postby joho » 9:04am, Thu 04 Oct, 2007

The problem is in /lists/admin/languages.php near the beginning of "class phplist_I18N {", at the function "phplist_I18N()". When a web browser that does not want english as the default language is used, and the web browser's desired language cannot be found, PHPLIST needs to do a fallback to English, but it doesn't.

I've fixed what needs to be fixed (it's a really minor tweak) and will post it somewhere. This is a problem for the non-english speaking world (which is the majority of the world :-), so I'm surprised more people haven't run into it and I'm equally surprised it hasn't been fixed.

There is also an earlier place in that file where PHPLIST attempts to check what the web browser wants. If nothing is set, it falls back to English there. It should at the same time check if the requested language file exists. In other words:
Code: Select all
if (not isset (requested_language)
    not exist (requested_language))
   FallBackToEnglish ();

(the above is not PHP code, do *not* paste it into the languages.php file)

The fix looks like this (there are a number of ways of doing this, this works for me, if you break it, you own all the pieces). Replace the whole function block so that it looks like this instead:
Code: Select all
  function phplist_I18N() {
    $this->basedir = dirname(__FILE__).'/lan/';

    if (isset($_SESSION['adminlanguage']) && is_dir($this->basedir.$_SESSION['adminlanguage']['iso'])) {
      $this->language = $_SESSION['adminlanguage']['iso'];
    } else {
        $_SESSION['adminlanguage'] = array(
        "info" => 'en',
        "iso" => 'en',
        "charset" => $LANGUAGES['en'][1],
      if (!is_dir($this->basedir.$_SESSION['adminlanguage']['iso'])) {
          print "Not set or found: ".$_SESSION['adminlanguage'];
          $this->language = $_SESSION['adminlanguage']['iso'];

Posts: 10
Joined: 9:19am, Wed 05 Sep, 2007
Location: Stockholm, Sweden

not workin'

Postby eddie_dw » 11:30am, Wed 09 Apr, 2008

Thanx for posting this.
I tried but it doesn't work... The "Not set or found:Array" is gone but now I get a blank page.
PL Nut
Posts: 15
Joined: 12:08pm, Sat 18 Mar, 2006

Re: [fix] Not set or found: Array

Postby Life » 3:36pm, Fri 03 Jul, 2009

I had this problem and now it's gone. so thanks a lot! :D
PL Nut
Posts: 25
Joined: 2:04pm, Fri 11 Jul, 2008

Re: [fix] Not set or found: Array

Postby endjo » 8:56pm, Tue 01 Sep, 2009

Thanks for this solution Joho, I had this problem, but after I read this post everything is fine for me.
PL Nut
Posts: 18
Joined: 6:52pm, Mon 31 Aug, 2009

Return to Advanced Answers, Howtos, Tips & Tricks

Who is online

Users browsing this forum: No registered users and 2 guests