Skip to content

Commit 172d5e8

Browse files
committed
fix(condition): infinite loop detection
1 parent 9af4714 commit 172d5e8

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

ajax/showfields.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@
5858
try {
5959
$visibility = PluginFormcreatorFields::updateVisibility($_POST);
6060
} catch (Exception $e) {
61+
echo json_encode([
62+
'error' => $e->getMessage(),
63+
]);
6164
http_response_code(500);
6265
exit();
6366
}

inc/fields.class.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ public static function isVisible(PluginFormcreatorConditionnableInterface $item,
140140
/** @var CommonDBTM $item */
141141
$itemtype = get_class($item);
142142
$itemId = $item->getID();
143-
if (!isset(self::$visibility[$itemtype][$itemId])) {
143+
144+
if (!isset(self::$visibility[$itemtype]) || !array_key_exists($itemId, self::$visibility[$itemtype])) {
144145
self::$visibility[$itemtype][$itemId] = null;
145146
} else if (self::$visibility[$itemtype][$itemId] !== null) {
146147
return self::$visibility[$itemtype][$itemId];

0 commit comments

Comments
 (0)