8000 [VarDumper] Keep a ref to objects to ensure their handle cannot be reused while cloning by nicolas-grekas · Pull Request #30350 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[VarDumper] Keep a ref to objects to ensure their handle cannot be reused while cloning #30350

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

Merged
merged 1 commit into from
Feb 23, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/Symfony/Component/VarDumper/Cloner/VarCloner.php
< 6407 td id="diff-27fadd95a89adb229b33890577a4495e15bdbc1b25f12c44f7afa8a12a00d37bL38" data-line-number="38" class="blob-num blob-num-context js-linkable-line-number">
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ protected function doClone($var)
$indexedArrays = []; // Map of queue indexes that hold numerically indexed arrays
$hardRefs = []; // Map of original zval hashes to stub objects
$objRefs = []; // Map of original object handles to their stub object counterpart
$objects = []; // Keep a ref to objects to ensure their handle cannot be reused while cloning
$resRefs = []; // Map of original resource handles to their stub object counterpart
$values = []; // Map of stub objects' hashes to original values
$maxItems = $this->maxItems;
Expand Down Expand Up @@ -200,6 +201,7 @@ protected function doClone($var)
}
if (empty($objRefs[$h])) {
$objRefs[$h] = $stub;
$objects[] = $v;
} else {
$stub = $objRefs[$h];
++$stub->refCount;
Expand Down
0