[VarDumper] Dont use empty(), it chokes on eg GMP objects
This commit is contained in:
parent
0d433cda7c
commit
1b141732db
@ -118,8 +118,8 @@ class Caster
|
|||||||
|
|
||||||
if (null === $v) {
|
if (null === $v) {
|
||||||
$type |= self::EXCLUDE_NULL & $filter;
|
$type |= self::EXCLUDE_NULL & $filter;
|
||||||
}
|
$type |= self::EXCLUDE_EMPTY & $filter;
|
||||||
if (empty($v)) {
|
} elseif (false === $v || '' === $v || '0' === $v || 0 === $v || 0.0 === $v || array() === $v) {
|
||||||
$type |= self::EXCLUDE_EMPTY & $filter;
|
$type |= self::EXCLUDE_EMPTY & $filter;
|
||||||
}
|
}
|
||||||
if ((self::EXCLUDE_NOT_IMPORTANT & $filter) && !in_array($k, $listedProperties, true)) {
|
if ((self::EXCLUDE_NOT_IMPORTANT & $filter) && !in_array($k, $listedProperties, true)) {
|
||||||
|
@ -94,13 +94,16 @@ class VarCloner extends AbstractCloner
|
|||||||
// Create $stub when the original value $v can not be used directly
|
// Create $stub when the original value $v can not be used directly
|
||||||
// If $v is a nested structure, put that structure in array $a
|
// If $v is a nested structure, put that structure in array $a
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case empty($v):
|
case null === $v:
|
||||||
case true === $v:
|
case \is_bool($v):
|
||||||
case \is_int($v):
|
case \is_int($v):
|
||||||
case \is_float($v):
|
case \is_float($v):
|
||||||
continue 2;
|
continue 2;
|
||||||
|
|
||||||
case \is_string($v):
|
case \is_string($v):
|
||||||
|
if ('' === $v) {
|
||||||
|
continue 2;
|
||||||
|
}
|
||||||
if (!\preg_match('//u', $v)) {
|
if (!\preg_match('//u', $v)) {
|
||||||
$stub = new Stub();
|
$stub = new Stub();
|
||||||
$stub->type = Stub::TYPE_STRING;
|
$stub->type = Stub::TYPE_STRING;
|
||||||
@ -124,6 +127,9 @@ class VarCloner extends AbstractCloner
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case \is_array($v):
|
case \is_array($v):
|
||||||
|
if (!$v) {
|
||||||
|
continue 2;
|
||||||
|
}
|
||||||
$stub = $arrayStub;
|
$stub = $arrayStub;
|
||||||
$stub->class = Stub::ARRAY_INDEXED;
|
$stub->class = Stub::ARRAY_INDEXED;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user