Skip to content

PHP Warning: Undefined array key "survey_reminder" in NotificationTargetCommonITILObject.php #54

@giovanny07

Description

@giovanny07

Bug description

When GLPI processes ticket notifications, the following warning is repeatedly logged in php-errors.log:

[2026-02-18 16:25:13] glpiphplog.WARNING: *** PHP Warning (2): Undefined array key "survey_reminder"
in /usr/share/glpi/src/NotificationTargetCommonITILObject.php at line 107

Root cause

In inc/notificationtargetticket.class.php, the addEvents() method assigns the survey_reminder
key to $target->events without first checking if it already exists:

static function addEvents(NotificationTargetTicket $target) {
   $target->events['survey_reminder']
      = __('Survey Reminder', 'satisfaction');
}

Under PHP 8.2, accessing an array key that has not been initialized triggers an Undefined array key
warning. This happens when GLPI core reads $target->events in contexts where the plugin hooks
have not yet fully initialized (e.g. cron jobs, CLI execution).

Fix

Add an isset() check before assigning the key:

static function addEvents(NotificationTargetTicket $target) {
   if (!isset($target->events['survey_reminder'])) {
      $target->events['survey_reminder']
         = __('Survey Reminder', 'satisfaction');
   }
}

Environment

  • Plugin version: 1.6.2
  • GLPI version: 10.0.23
  • PHP version: 8.2

Regards

Giovanny Rodriguez
Imagunet Colombia

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions