Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

$depth property overflow #208

Closed
Markard opened this issue Dec 18, 2015 · 4 comments
Closed

$depth property overflow #208

Markard opened this issue Dec 18, 2015 · 4 comments

Comments

@Markard
Copy link

Markard commented Dec 18, 2015

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?

@Markard Markard changed the title More $depth property overflow Dec 18, 2015
@Markard
Copy link
Author

Markard commented Dec 21, 2015

Hello again. I figured out why the problem occurs.
It looks like when JsonDecodingException is thrown the RefResolver::$depth doesn't restored to initial state.

@jojo1981
Copy link

@Markard I think this issue can be closed? Also after merging: #245 the $depth is not used anymore.

@Markard Markard closed this as completed Apr 11, 2016
@Markard
Copy link
Author

Markard commented Apr 11, 2016

Sure, thanks.

@jojo1981
Copy link

@Markard Thanks for closing this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants