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 29a0683

Browse filesBrowse files
[VarDumper] Keep a ref to objects to ensure their handle cannot be reused while cloning
1 parent 848a830 commit 29a0683
Copy full SHA for 29a0683

File tree

1 file changed

+2
-0
lines changed
Filter options

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.