glpi-project / glpi

GLPI is a Free Asset and IT Management Software package, Data center management, ITIL Service Desk, licenses tracking and software auditing.
https://glpi-project.org
GNU General Public License v3.0
3.97k stars 1.25k forks source link

Remove unused `$LANG` global variable #17369

Closed cedric-anne closed 4 days ago

cedric-anne commented 4 days ago
Q A
Bug fix? no
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets -

This variable is not used by GLPI.

I did not find any usage in plugins that would be affected by this removal. Indeed, the following snippets will still work:

// a simple declaration
global $LANG;
$LANG['pluginkey']['xxx'] = 'value';
// will anyway trigger a warning if the corresponding entry is not defined
global $LANG
echo $LANG['pluginkey']['xxx'];
// a safe usage
global $LANG;
if (isset($LANG['genericobject'][$class][0])) {
    return $LANG['genericobject'][$class][0];
}
orthagh commented 4 days ago

First snippet doesn't trigger a warning about an uninitialized array ?

cedric-anne commented 4 days ago

First snippet doesn't trigger a warning about an uninitialized array ?

No, PHP consider it as a valid variable initialization.