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

local_vars_dump with recursive data structures causes infinite recursion #410

Closed
jlesueur opened this issue Sep 26, 2018 · 5 comments
Closed
Assignees
Labels
Type: Enhancement Changes that add to, improve upon, enhance, or extend the existing component.
Milestone

Comments

@jlesueur
Copy link
Contributor

Unfortunately some of our parameters are recursive. Here is a super simplified example:

$obj = [
  'key1' => 'value',
  'key2' => 'value'
];

$obj['key3'] => &$obj;

This causes Utility::serialize($obj) to enter an infinite recursion. So if local_vars_dump is on, errors can cause infinite recursion.

I kind of think a simple fix is to implement a maximum depth for the serialize method. Maybe a configurable one, with a default of somewhere between 5 and 10? If that solution sounds ok, I'd be willing to put together a PR for it.

@jessewgibbs
Copy link
Contributor

@jlesueur thanks for reporting this issue.

@ArturMoczulski what do you think about the proposal to set a maximum depth for the serialize() method? I imagine we'd want to have it be a configurable setting...

@jessewgibbs jessewgibbs added the Type: Enhancement Changes that add to, improve upon, enhance, or extend the existing component. label Sep 28, 2018
@coryvirok
Copy link
Contributor

We also need the serialization code to detect loops. See the other sdks for a reference implementation.

@ArturMoczulski
Copy link
Contributor

@jessewgibbs yeah I think that's good

@jlesueur if you want to prepare a PR that would be awesome

@coryvirok I'll check out other SDKs, although I believe introducing default max depth should solve the problem

@coryvirok
Copy link
Contributor

coryvirok commented Sep 28, 2018 via email

@JohnKendhammer
Copy link
Contributor

Issue has been resolved with PR #414

@ArturMoczulski ArturMoczulski added this to the v1.6.4 milestone Oct 18, 2018
@ArturMoczulski ArturMoczulski self-assigned this Oct 18, 2018
@ArturMoczulski ArturMoczulski modified the milestones: v1.6.4, v1.7.0 Oct 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Enhancement Changes that add to, improve upon, enhance, or extend the existing component.
Projects
None yet
Development

No branches or pull requests

5 participants