Skip to content

Commit

Permalink
fix(condition): infinite loop detection
Browse files Browse the repository at this point in the history
  • Loading branch information
btry committed Feb 14, 2023
1 parent 9af4714 commit 172d5e8
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 3 additions & 0 deletions ajax/showfields.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@
try {
$visibility = PluginFormcreatorFields::updateVisibility($_POST);
} catch (Exception $e) {
echo json_encode([
'error' => $e->getMessage(),
]);
http_response_code(500);
exit();
}
Expand Down
3 changes: 2 additions & 1 deletion inc/fields.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ public static function isVisible(PluginFormcreatorConditionnableInterface $item,
/** @var CommonDBTM $item */
$itemtype = get_class($item);
$itemId = $item->getID();
if (!isset(self::$visibility[$itemtype][$itemId])) {

if (!isset(self::$visibility[$itemtype]) || !array_key_exists($itemId, self::$visibility[$itemtype])) {
self::$visibility[$itemtype][$itemId] = null;
} else if (self::$visibility[$itemtype][$itemId] !== null) {
return self::$visibility[$itemtype][$itemId];
Expand Down

0 comments on commit 172d5e8

Please sign in to comment.