sebastianbergmann/recursion-context

Variables processed by this component are modified

sebastianbergmann opened this issue · 7 comments

@bwoebi It looks like the SplObjectStorage instance that is used by the SebastianBergmann\RecursionContext\Context class "leaks" into the variable that is passed to add(). This probably happens in https://github.com/sebastianbergmann/recursion-context/blob/master/src/Context.php#L112.

Variables processed using this component must not be modified by it.

This is no bug, you just need to not access the value between add() and __destruct().

Make a copy (like in sebastianbergmann/exporter#17) before passing to add() and it's all fine.

The mistake was to tag this as a micro version instead of a major version (as semantics changed).

The tags have been deleted and the releases have been removed from Packagist. I'll try to sort this out on Sunday.

I'm also sorry for the confusion I caused this week and missing to update all deps in time too :-/

No worries. New releases of the affected packages have been made. As of sebastianbergmann/phpunit@a7ffe99 PHPUnit 5.6 will pull in those new versions.

It shouldn't be needed to release a new major for the consumers of recursion-context (like exporter) - there a micro version bump (which accepts ^1||^2) would've been fine after my patch, as the semantics of their API didn't change - just the recursion-context.

Maybe, but it's done now. For PHPUnit it will be 5.6.5, though.