Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 83fec23

Browse filesBrowse files
committed
bug #30350 [VarDumper] Keep a ref to objects to ensure their handle cannot be reused while cloning (nicolas-grekas)
This PR was merged into the 3.4 branch. Discussion ---------- [VarDumper] Keep a ref to objects to ensure their handle cannot be reused while cloning | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | - | License | MIT | Doc PR | - Fixes the root issue that led to #30311 (comment) Commits ------- 29a0683 [VarDumper] Keep a ref to objects to ensure their handle cannot be reused while cloning
2 parents 9e4ff87 + 29a0683 commit 83fec23
Copy full SHA for 83fec23

File tree

Expand file treeCollapse file tree

1 file changed

+2
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+2
-0
lines changed

‎src/Symfony/Component/VarDumper/Cloner/VarCloner.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/VarDumper/Cloner/VarCloner.php
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ protected function doClone($var)
3333
$indexedArrays = []; // Map of queue indexes that hold numerically indexed arrays
3434
$hardRefs = []; // Map of original zval hashes to stub objects
3535
$objRefs = []; // Map of original object handles to their stub object counterpart
36+
$objects = []; // Keep a ref to objects to ensure their handle cannot be reused while cloning
3637
$resRefs = []; // Map of original resource handles to their stub object counterpart
3738
$values = []; // Map of stub objects' hashes to original values
3839
$maxItems = $this->maxItems;
@@ -200,6 +201,7 @@ protected function doClone($var)
200201
}
201202
if (empty($objRefs[$h])) {
202203
$objRefs[$h] = $stub;
204+
$objects[] = $v;
203205
} else {
204206
$stub = $objRefs[$h];
205207
++$stub->refCount;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.