Skip to content

Fix lazy object inspection executing property hooks - #621

Open
mildabre wants to merge 1 commit into
nette:masterfrom
mildabre:lazy-property-hook-exposer
Open

Fix lazy object inspection executing property hooks#621
mildabre wants to merge 1 commit into
nette:masterfrom
mildabre:lazy-property-hook-exposer

Conversation

@mildabre

Copy link
Copy Markdown

When Tracy inspects a lazy object, reading a property via ReflectionProperty::getValue() may execute its getter hook.

This is unsafe for a debugging tool because a getter can execute arbitrary application code, mutate object state, initialize dependencies, or throw an exception — especially when the object is inspected in an incomplete lifecycle state.

This PR:

reads initialized properties using getRawValue() instead of getValue()
excludes virtual properties, which have no backing storage
keeps lazy and uninitialized properties excluded as before

A debugging tool should inspect the existing object state, not execute property getter code just to obtain a value.

Debugging tools should inspect existing object state, not execute property getter code. Virtual properties are excluded because they have no backing value.
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

Successfully merging this pull request may close these issues.

1 participant