fields icon indicating copy to clipboard operation
fields copied to clipboard

"Undefined index: HTTP_REFERER" with an additionnal field in ticket [1.13.0]

Open Lacro59 opened this issue 2 years ago • 1 comments

When you are an additional field before the save button in the ticket form, you get an error on "Undefined Index: HTTP_REFERER":

Notice: Undefined index: HTTP_REFERER in C:\wamp64\www\glpi\plugins\fields\inc\field.class.php on line 757
Notice: Undefined index: HTTP_REFERER in C:\wamp64\www\glpi\plugins\fields\inc\field.class.php on line 758

The configuration of element: image

Lacro59 avatar May 19 '22 13:05 Lacro59

I've fixed the issue in adding an empty value when null:

if (stristr($container_obj->fields['itemtypes'], 'Ticket') !== false
   && $container_obj->fields['type'] == 'dom'
   && strpos($_SERVER['HTTP_REFERER'] ?? '', ".injector.php") === false
   && strpos($_SERVER['HTTP_REFERER'] ?? '', ".public.php") === false) {
   $html.= "<th width='13%'>$label</th>";
} else {
  $html.= "<td>$label</td>";
}

Lacro59 avatar May 19 '22 13:05 Lacro59

There has been no activity on this issue for some time and therefore it is considered stale

If this issue is related to a bug, please try to reproduce on latest release (GLPI and plugin). If the problem persist, feel free to open a new issue.

If it is related to a new feature, please open a topic to discuss with community about this enhancement on suggestion website.

You may also consider taking a subscription to get professionnal support or contact GLPI editor team directly.

stonebuzz avatar Feb 22 '24 07:02 stonebuzz