bug #21973 [VarDumper] Add missing isset() checks in some casters (nicolas-grekas)
This PR was merged into the 3.2 branch.
Discussion
----------
[VarDumper] Add missing isset() checks in some casters
| Q | A
| ------------- | ---
| Branch? | 3.2
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #21943
| License | MIT
| Doc PR | -
As spotted by @lyrixx, this is what's causing high mem use on 3.2.
Fix coming to 2.7 (which has very different code base, thus dedicated PR).
Commits
-------
8f0edfb
[VarDumper] Add missing isset() checks in some casters
This commit is contained in:
commit
7cbbd8fad4
@ -132,8 +132,10 @@ class Caster
|
||||
|
||||
public static function castPhpIncompleteClass(\__PHP_Incomplete_Class $c, array $a, Stub $stub, $isNested)
|
||||
{
|
||||
$stub->class .= '('.$a['__PHP_Incomplete_Class_Name'].')';
|
||||
unset($a['__PHP_Incomplete_Class_Name']);
|
||||
if (isset($a['__PHP_Incomplete_Class_Name'])) {
|
||||
$stub->class .= '('.$a['__PHP_Incomplete_Class_Name'].')';
|
||||
unset($a['__PHP_Incomplete_Class_Name']);
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
@ -218,7 +218,9 @@ class ExceptionCaster
|
||||
}
|
||||
|
||||
if (!($filter & Caster::EXCLUDE_VERBOSE)) {
|
||||
self::traceUnshift($trace, $xClass, $a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line']);
|
||||
if (isset($a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line'])) {
|
||||
self::traceUnshift($trace, $xClass, $a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line']);
|
||||
}
|
||||
$a[$xPrefix.'trace'] = new TraceStub($trace, self::$traceArgs);
|
||||
}
|
||||
if (empty($a[$xPrefix.'previous'])) {
|
||||
@ -226,7 +228,9 @@ class ExceptionCaster
|
||||
}
|
||||
unset($a[$xPrefix.'string'], $a[Caster::PREFIX_DYNAMIC.'xdebug_message'], $a[Caster::PREFIX_DYNAMIC.'__destructorException']);
|
||||
|
||||
$a[Caster::PREFIX_PROTECTED.'file'] = new LinkStub($a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line']);
|
||||
if (isset($a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line'])) {
|
||||
$a[Caster::PREFIX_PROTECTED.'file'] = new LinkStub($a[Caster::PREFIX_PROTECTED.'file'], $a[Caster::PREFIX_PROTECTED.'line']);
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
@ -31,8 +31,10 @@ class RedisCaster
|
||||
$prefix = Caster::PREFIX_VIRTUAL;
|
||||
|
||||
if (defined('HHVM_VERSION_ID')) {
|
||||
$ser = $a[Caster::PREFIX_PROTECTED.'serializer'];
|
||||
$a[Caster::PREFIX_PROTECTED.'serializer'] = isset(self::$serializer[$ser]) ? new ConstStub(self::$serializer[$ser], $ser) : $ser;
|
||||
if (isset($a[Caster::PREFIX_PROTECTED.'serializer'])) {
|
||||
$ser = $a[Caster::PREFIX_PROTECTED.'serializer'];
|
||||
$a[Caster::PREFIX_PROTECTED.'serializer'] = isset(self::$serializer[$ser]) ? new ConstStub(self::$serializer[$ser], $ser) : $ser;
|
||||
}
|
||||
|
||||
return $a;
|
||||
}
|
||||
|
Reference in New Issue
Block a user