Skip to content

Commit e73049d

Browse files
committed
AC-3483:: SVC false-positive: modifying system.xml file from another module
1 parent 162e923 commit e73049d

File tree

1 file changed

+24
-20
lines changed

1 file changed

+24
-20
lines changed

src/Analyzer/SystemXml/Analyzer.php

Lines changed: 24 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -97,29 +97,33 @@ public function analyze($registryBefore, $registryAfter)
9797

9898
if ($addedNodes) {
9999
$afterFile = $registryAfter->mapping[XmlRegistry::NODES_KEY][$moduleName];
100-
$baseDir = $this->getBaseDir($afterFile);
101-
foreach ($addedNodes as $nodeId => $node) {
102-
$newNodeData = $this->getNodeData($node);
103-
$nodePath = $newNodeData['path'];
104-
105-
// Extract section, group, and fieldId with error handling
106-
$extractedData = $this->extractSectionGroupField($nodePath);
107-
if ($extractedData === null) {
108-
// Skip the node if its path is invalid
109-
continue;
110-
}
100+
if (strpos($afterFile, '_files') !== false) {
101+
$this->reportAddedNodes($afterFile,$addedNodes);
102+
} else {
103+
$baseDir = $this->getBaseDir($afterFile);
104+
foreach ($addedNodes as $nodeId => $node) {
105+
$newNodeData = $this->getNodeData($node);
106+
$nodePath = $newNodeData['path'];
107+
108+
// Extract section, group, and fieldId with error handling
109+
$extractedData = $this->extractSectionGroupField($nodePath);
110+
if ($extractedData === null) {
111+
// Skip the node if its path is invalid
112+
continue;
113+
}
111114

112-
// Extract section, group, and fieldId
113-
list($sectionId, $groupId, $fieldId) = $extractedData;
115+
// Extract section, group, and fieldId
116+
list($sectionId, $groupId, $fieldId) = $extractedData;
114117

115-
// Call function to check if this field is duplicated in other system.xml files
116-
$isDuplicated = $this->isDuplicatedFieldInXml($baseDir, $sectionId, $groupId, $fieldId, $afterFile);
118+
// Call function to check if this field is duplicated in other system.xml files
119+
$isDuplicated = $this->isDuplicatedFieldInXml($baseDir, $sectionId, $groupId, $fieldId, $afterFile);
117120

118-
foreach ($isDuplicated as $isDuplicatedItem) {
119-
if ($isDuplicatedItem['status'] === 'duplicate') {
120-
$this->reportDuplicateNodes($afterFile, [$nodeId => $node ]);
121-
} else {
122-
$this->reportAddedNodes($afterFile, [$nodeId => $node ]);
121+
foreach ($isDuplicated as $isDuplicatedItem) {
122+
if ($isDuplicatedItem['status'] === 'duplicate') {
123+
$this->reportDuplicateNodes($afterFile, [$nodeId => $node]);
124+
} else {
125+
$this->reportAddedNodes($afterFile, [$nodeId => $node]);
126+
}
123127
}
124128
}
125129
}

0 commit comments

Comments
 (0)