mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 15:51:48 +03:00
avoid infinite recursion when parsing jms metadata
This commit is contained in:
parent
28f059fff0
commit
db4a375992
@ -30,6 +30,8 @@ class JmsMetadataParser implements ParserInterface
|
||||
*/
|
||||
private $commentExtractor;
|
||||
|
||||
private $parsedClasses = array();
|
||||
|
||||
/**
|
||||
* Constructor, requires JMS Metadata factory
|
||||
*/
|
||||
@ -82,12 +84,19 @@ class JmsMetadataParser implements ParserInterface
|
||||
'readonly' => $item->readOnly
|
||||
);
|
||||
|
||||
// if class already parsed, continue, to avoid infinite recursion
|
||||
if (in_array($dataType['class'], $this->parsedClasses)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
//check for nested classes with JMS metadata
|
||||
if ($dataType['class'] && null !== $this->factory->getMetadataForClass($dataType['class'])) {
|
||||
$this->parsedClasses[] = $dataType['class'];
|
||||
$params[$name]['children'] = $this->parse($dataType['class']);
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->parsedClasses = array();
|
||||
|
||||
return $params;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user