diff --git a/src/Rules/UseSafeFunctionsRule.php b/src/Rules/UseSafeFunctionsRule.php index d649184..4f3f76c 100644 --- a/src/Rules/UseSafeFunctionsRule.php +++ b/src/Rules/UseSafeFunctionsRule.php @@ -33,6 +33,15 @@ public function processNode(Node $node, Scope $scope): array $unsafeFunctions = FunctionListLoader::getFunctionList(); if (isset($unsafeFunctions[$functionName])) { + if ($functionName === "json_decode" || $functionName === "json_encode") { + foreach ($node->args as $arg) { + if ($arg->name instanceof Node\Identifier && $arg->name->toLowerString() === "flags") { + if ($this->argValueIncludeJSONTHROWONERROR($arg)) { + return []; + } + } + } + } if ( $functionName === "json_decode" && $this->argValueIncludeJSONTHROWONERROR($node->getArgs()[3] ?? null)