Skip to content

GLPI 11 compatibility: community patch set available (covers 5 bug classes) #64

@bygadd

Description

@bygadd

Summary

Tracking GLPI 11 compatibility issues we hit on a production room plugin installation (v3.1.3, latest upstream), and sharing a tested community patch set that fixes them.

This is intended as a reference for other administrators hitting the same problems while a maintainer can pick up the changes. The attached archive is a drop-in solution — backup, replace files, run SQL migration, clear cache. Tested end-to-end on a production GLPI 11.0.7 instance with ~187 GB database and 13,686 inventory requests/hour.

Environment

  • GLPI: 11.0.7
  • PHP: 8.3.6 (Ubuntu 24.04 LTS)
  • MySQL: 8.0.45
  • Plugin version: 3.1.3
  • Plugin install location: /var/www/glpi/marketplace/room

Bug classes covered

1. Plugin cannot be installed/activated on GLPI 11

plugin_room_check_prerequisites() rejects GLPI versions outside 9.5..9.6. The patch raises the upper bound to 11.1.

2. PHP 8.3 / GLPI 11 fatal errors

  • PluginRoomProfile::cleanProfile() — null pointer when $_SESSION['glpiactiveprofile']['id'] is not set (e.g. CLI context, or just after a profile change).
  • $DB->request($sql_string) — deprecated SQL string syntax removed in GLPI 11; needs array criteria.
  • in_array('PluginRoomRoom', $_SESSION['glpiactiveprofile']['helpdesk_item_type']) — argument can be null, throws TypeError on PHP 8.4 and a deprecation on 8.1+. Needs is_array() guard.

3. ~700,000 GLPI warnings per day on busy installations

GLPI 11 added strict foreign key validation in DbUtils.php (line ~2240 in 11.0.7). Every database operation that touches a room table now produces warnings like:

*** User Warning: Invalid relations declared between "glpi_plugin_room_roomtypes"
and "glpi_plugin_room_rooms" table. Target field "type" is not a foreign key field.
at DbUtils.php line 2242

The plugin uses non-conventional column names (type, access, dropdown1, dropdown2, tech_num in glpi_plugin_room_rooms, and rooms_id in glpi_plugin_room_rooms_computers) that GLPI 11's strict validation rejects. On installations with active inventory traffic, this produces hundreds of thousands of warnings per day, filling php-errors.log and slowing down log rotation.

4. Broken cascade deletes (latent in GLPI 10, surfaced by GLPI 11 validation)

Because the FK relations are declared with non-_id column names, GLPI 11's cascade delete simply skips them. Deleting a room type, access condition, dropdown, or assigned technician leaves orphaned 0 references in glpi_plugin_room_rooms. This was equally broken in GLPI 10 — just silent.

5. PHP class name mismatch with GLPI 11 strict FK resolution

GLPI 11 resolves FK column suffixes back to PHP class names using a lowercase-strip pattern. Tables like glpi_plugin_room_roomtypes need a class named PluginRoomRoomtype (lowercase t), not PluginRoomRoomType (uppercase T).

Affected classes:

  • PluginRoomRoomTypePluginRoomRoomtype
  • PluginRoomRoomAccessCondPluginRoomRoomaccesscond

Patch set

Attached: room-glpi11-compat-2026-05-14.zip (or .tar.gz)

Contents

room-glpi11-compat-2026-05-14/
├── README.md                       (BG + EN)
├── CHANGELOG.md
├── apply-patch.sh                  (automated installer, idempotent)
├── files/                          (11 patched files, drop-in)
│   ├── setup.php                   (raises GLPI version check to 11.1)
│   ├── hook.php
│   ├── inc/
│   │   ├── profile.class.php
│   │   ├── room.class.php
│   │   ├── room_computer.class.php
│   │   ├── roomtype.class.php
│   │   └── roomaccesscond.class.php
│   └── front/
│       ├── roomtype.php
│       ├── roomtype.form.php
│       ├── roomaccesscond.php
│       └── roomaccesscond.form.php
└── migration/
    └── upgrade-to-glpi11.sql       (78 lines, 8 ALTER TABLE in one transaction)

Database changes

Single transaction, 2 tables affected:

glpi_plugin_room_rooms — rename 5 columns:

Old New
type plugin_room_roomtypes_id
access plugin_room_roomaccessconds_id
dropdown1 plugin_room_dropdown1s_id_1
dropdown2 plugin_room_dropdown1s_id_2
tech_num users_id_tech

glpi_plugin_room_rooms_computers — rename 1 column:

Old New
rooms_id plugin_room_rooms_id

All renamed columns are converted from int (signed) to int unsigned to satisfy GLPI 11's FK type requirements. Old indexes are dropped and recreated with new names.

Code changes

Approximately 50 changes across 11 PHP files:

  • setup.phpplugin_room_check_prerequisites() raises upper bound to GLPI 11.1
  • hook.php — schema definitions, plugin_room_getDatabaseRelations(), class references, null-safety guard for helpdesk_item_type
  • inc/profile.class.php — null-safety guards, $DB->request() migration to array criteria
  • inc/room.class.php — 21 references (search options linkfields, form names, $this->fields[] accesses, raw SQL JOIN, INSERT/SELECT WHERE clauses)
  • inc/room_computer.class.php$items_id_1 constant
  • inc/roomtype.class.php, inc/roomaccesscond.class.php — class declarations
  • front/{roomtype,roomaccesscond}.php and front/{roomtype,roomaccesscond}.form.php — class instantiations

Installation

# Backup database first
mysqldump -u root -p glpi | gzip > glpi-backup.sql.gz
 
# Run installer (auto-detects GLPI 11 config at /etc/glpi/config_db.php,
# falls back to GLPI 10 locations)
sudo bash apply-patch.sh
 
# Restart PHP-FPM
sudo systemctl restart php8.3-fpm

The installer is idempotent — re-running it detects an already-migrated schema and skips the SQL step.

Verification

truncate -s 0 /var/log/glpi/php-errors.log
sleep 60
grep -c "Invalid relations.*plugin_room" /var/log/glpi/php-errors.log

Expected: 0

UI tests (incognito):

  1. Plugin activates without prerequisite errors
  2. Assets / Rooms — list loads
  3. Open a room — form loads, dropdowns show values
  4. Setup / Dropdowns / Room types — list loads, editing/creating works
  5. Setup / Dropdowns / Conditions of Access — same
  6. Edit room type, save — persists correctly

Results on production

Metric Before After
Plugin installable on GLPI 11 no yes
Warning types in php-errors.log 6 0
Warnings per inventory request ~21 0
Warnings per day (13,686 inv/hour) ~700,000 0
Cascade delete of room type/condition/dropdown silently broken works
Setup / Dropdowns / Room types UI works works
Assets / Rooms UI works works

Compatibility notes

  • Patches assume the v3.1.3 schema. Installations with custom schema modifications may need manual adjustment to migration/upgrade-to-glpi11.sql.
  • Class renames are technically backward-incompatible for external code that references PluginRoomRoomType or PluginRoomRoomAccessCond by exact case. We didn't find any such references in the wild (other plugins, custom code), but worth flagging.
  • All patched files carry a marker comment at the top: // GLPI 11 FK rename: ... — easy to detect already-patched installations.
  • Tested only on MySQL 8.0; should work on MariaDB but unverified.

Happy to help

If a maintainer wants to mainline any of this — happy to open a PR with the changes broken into logical commits (prerequisites bump / null-safety / FK column renames / class renames). The patch set was developed against a real GLPI 11.0.7 production instance and is in active use.

Also happy to answer questions or test changes if anyone wants to adapt this for their installation.


cc: anyone hitting the same Invalid relations declared between "glpi_plugin_room_*" warnings, cleanProfile() fatal errors, or This plugin requires GLPI >= 9.5 && <= 9.6 activation errors on GLPI 11.

room-glpi11-compat-2026-05-14.tar.gz
room-glpi11-compat-2026-05-14.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions