Issues (1963)

html/user/set_language.php (1 issue)

Labels
Severity
1
<?php
2
// This file is part of BOINC.
3
// http://boinc.berkeley.edu
4
// Copyright (C) 2016 University of California
5
//
6
// BOINC is free software; you can redistribute it and/or modify it
7
// under the terms of the GNU Lesser General Public License
8
// as published by the Free Software Foundation,
9
// either version 3 of the License, or (at your option) any later version.
10
//
11
// BOINC is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
// See the GNU Lesser General Public License for more details.
15
//
16
// You should have received a copy of the GNU Lesser General Public License
17
// along with BOINC.  If not, see <http://www.gnu.org/licenses/>.
18
19
require_once("../inc/util.inc");
20
require_once("../inc/translation.inc");
21
22
$languages = get_supported_languages();
0 ignored issues
show
Are you sure the assignment to $languages is correct as get_supported_languages() seems to always return null.

This check looks for function or method calls that always return null and whose return value is assigned to a variable.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
$object = $a->getObject();

The method getObject() can return nothing but null, so it makes no sense to assign that value to a variable.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
23
$lang = sanitize_tags(get_str("lang", true));
24
25
if (!in_array($lang, $languages) && $lang!="auto" && $lang!="en") {
26
    echo "Language $lang is not supported";
27
} else {
28
    send_cookie('lang', $lang, true);
29
    header('Location: index.php');
30
}
31
?>
32