Skip to content

Commit c5fb38d

Browse files
committed
Catching invalid XML errors when grabbing xml from response cache
1 parent 19c376c commit c5fb38d

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

Annotations/AnnotationGenerator.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,11 @@ protected function getCachedExampleResponseFile(string $pluginName, string $meth
941941
}
942942

943943
if (!$rawResult && $format === 'xml') {
944-
$exampleContents = json_encode($this->convertExampleXmlToObject($exampleContents));
944+
try {
945+
$exampleContents = json_encode($this->convertExampleXmlToObject($exampleContents));
946+
} catch (\Exception $e) {
947+
return '';
948+
}
945949
}
946950

947951
// Unless set otherwise, make sure that the example is around the max allowed characters. If raw, don't bother.

0 commit comments

Comments
 (0)