Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 13d4d1b

Browse files
[VarDumper] Dont use empty(), it chokes on eg GMP objects
1 parent 0d433cd commit 13d4d1b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,16 @@ protected function doClone($var)
9494
// Create $stub when the original value $v can not be used directly
9595
// If $v is a nested structure, put that structure in array $a
9696
switch (true) {
97-
case empty($v):
98-
case true === $v:
97+
case \is_null($v):
98+
case \is_bool($v):
9999
case \is_int($v):
100100
case \is_float($v):
101101
continue 2;
102102

103103
case \is_string($v):
104+
if ('' === $v) {
105+
continue 2;
106+
}
104107
if (!\preg_match('//u', $v)) {
105108
$stub = new Stub();
106109
$stub->type = Stub::TYPE_STRING;
@@ -124,6 +127,9 @@ protected function doClone($var)
124127
break;
125128

126129
case \is_array($v):
130+
if (!$v) {
131+
continue 2;
132+
}
127133
$stub = $arrayStub;
128134
$stub->class = Stub::ARRAY_INDEXED;
129135

0 commit comments

Comments
 (0)