Skip to content

$depth property overflow #208

@Markard

Description

@Markard

Hi
I'm currently faced an issue with $depth property in RefResolver. Also I would like to notice that we have cyclic references and this is fine for us.

Example:

$retriever = new UriRetriever();
$schema = $retriever->retrieve('file://1.json');
RefResolver::$maxDepth = 10;
$refResolver = new RefResolver($retriever);
try {
    $refResolver->resolve($schema, 'file://schemas/');
} catch (JsonDecodingException $e) {}

And for example we reached a depth. But we still need to resolve another file in our script:

$retriever = new UriRetriever();
$schema = $retriever->retrieve('file://2.json');
$refResolver = new RefResolver($retriever);
try {
    $refResolver->resolve($schema, 'file://schemas/');
} catch (JsonDecodingException $e) {}

So we already get $depth on the start of second resolving. And I don't get why you use this property as "protected static". May it would be better to use just protected property or even function scope property?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions