From 3e685dffb2758a1c751fa7b6fd98a0f19d67fc8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Sat, 26 Oct 2024 18:23:33 +0200 Subject: [PATCH] fix phpstan --- htdocs/core/ajax/ajaxextrafield.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/core/ajax/ajaxextrafield.php b/htdocs/core/ajax/ajaxextrafield.php index 012651776f7..de0ea3d79a6 100644 --- a/htdocs/core/ajax/ajaxextrafield.php +++ b/htdocs/core/ajax/ajaxextrafield.php @@ -52,9 +52,15 @@ $search = GETPOST('search', 'restricthtml'); $page = GETPOSTINT('page'); $limit = 10; $offset = (($page - 1) * $limit); - +$element_ref = ''; +if (is_numeric($id)) { + $id = (int) $id; +} else { + $element_ref = $id; + $id = 0; +} // Load object according to $element -$object = fetchObjectByElement($id, $objecttype); +$object = fetchObjectByElement($id, $objecttype, $element_ref); if (empty($object->element)) { httponly_accessforbidden('Failed to get object with fetchObjectByElement(id=' . $id . ', objecttype=' . $objecttype . ')'); }