From 93cf24deffd55cb336725d7b61a13278c760080c Mon Sep 17 00:00:00 2001 From: whamulti <80924754+whamulti@users.noreply.github.com> Date: Thu, 29 Oct 2026 16:06:38 -0300 Subject: [PATCH] Fix undefined $CFG_GLPI in front/config.form.php Since GLPI 11, legacy front/ scripts are included from inside LegacyFileLoadController::__invoke(), so they no longer run in the global scope. The final else branch used $CFG_GLPI without declaring it global: two PHP warnings were logged on every direct access and root_doc evaluated to null, sending instances installed in a subdirectory to /front/config.form.php outside of GLPI. Fixes #166 Co-Authored-By: Claude Opus 5.5 --- CHANGELOG.md | 6 ++++++ front/config.form.php | 1 + 2 files changed, 7 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9901b8b..5de73a5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). +## [Unreleased] + +### Fixed + +- Fix undefined `$CFG_GLPI` in `front/config.form.php` (PHP warnings and wrong redirect when GLPI is installed in a subdirectory) + ## [1.5.0] - 2026-10-06 ### Added diff --git a/front/config.form.php b/front/config.form.php index 14625c7..6fe899d 100644 --- a/front/config.form.php +++ b/front/config.form.php @@ -48,5 +48,6 @@ } else { Session::checkRight(Config::$rightname, READ); /** @var array $CFG_GLPI */ + global $CFG_GLPI; Html::redirect($CFG_GLPI['root_doc'] . '/front/config.form.php?forcetab=PluginMetabaseConfig$1'); }