Skip to content

Commit ff102aa

Browse files
committed
publish debug.objAbstractStart, even if in objectsExclude array
1 parent 158ada9 commit ff102aa

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

src/Debug/AbstractObject.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function getAbstraction($obj, $method = null, &$hist = array())
7777
),
7878
'extends' => array(),
7979
'implements' => $reflector->getInterfaceNames(),
80-
'isExcluded' => $hist && \in_array($className, $this->abstracter->getCfg('objectsExclude')),
80+
'isExcluded' => \in_array($className, $this->abstracter->getCfg('objectsExclude')),
8181
'isRecursion' => \in_array($obj, $hist, true),
8282
'methods' => array(), // if !collectMethods, may still get ['__toString']['returnValue']
8383
'phpDoc' => array(
@@ -97,12 +97,12 @@ public function getAbstraction($obj, $method = null, &$hist = array())
9797
'hist' => $hist,
9898
));
9999
$keysTemp = \array_flip(array('collectPropertyValues','reflector','hist'));
100-
if (\array_filter(array($abs['isRecursion'], $abs['isExcluded']))) {
100+
if ($abs['isRecursion']) {
101101
return \array_diff_key($abs->getValues(), $keysTemp);
102102
}
103103
/*
104104
debug.objAbstractStart subscriber may
105-
set isExcluded to true (but not to false)
105+
set isExcluded
106106
set collectPropertyValues (boolean)
107107
set collectMethods (boolean)
108108
set stringified
@@ -167,7 +167,9 @@ private function getAbstractionDetails(Event $abs)
167167
public function onStart(Event $event)
168168
{
169169
$obj = $event->getSubject();
170-
if ($obj instanceof \mysqli && ($obj->connect_errno || !$obj->stat)) {
170+
if ($obj instanceof \DateTime || $obj instanceof \DateTimeImmutable) {
171+
$event['stringified'] = $obj->format(\DateTime::ISO8601);
172+
} elseif ($obj instanceof \mysqli && ($obj->connect_errno || !$obj->stat)) {
171173
// avoid "Property access is not allowed yet"
172174
$event['collectPropertyValues'] = false;
173175
}
@@ -183,9 +185,7 @@ public function onStart(Event $event)
183185
public function onEnd(Event $event)
184186
{
185187
$obj = $event->getSubject();
186-
if ($obj instanceof \DateTime || $obj instanceof \DateTimeImmutable) {
187-
$event['stringified'] = $obj->format(\DateTime::ISO8601);
188-
} elseif ($obj instanceof \DOMNodeList) {
188+
if ($obj instanceof \DOMNodeList) {
189189
// for reasons unknown, DOMNodeList's properties are invisible to reflection
190190
$event['properties']['length'] = \array_merge(static::$basePropInfo, array(
191191
'type' => 'integer',

src/Debug/Output/HtmlObject.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,9 @@ public function dump($abs)
4747
.' <span class="t_recursion">*RECURSION*</span>';
4848
}
4949
if ($abs['isExcluded']) {
50-
return $strClassName
51-
.' <span class="excluded">(not inspected)</span>';
50+
return $this->dumpToString($abs)
51+
.$strClassName."\n"
52+
.'<span class="excluded">(not inspected)</span>';
5253
}
5354
$html = $this->dumpToString($abs)
5455
.$strClassName."\n"

tests/TypeObjectTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ public function providerTestMethod()
8989
$this->assertContains(implode("\n", array(
9090
'<dt class="properties">properties <span class="text-muted">(via __debugInfo)</span></dt>',
9191
'<dd class="magic info">This object has a <code>__get</code> method</dd>',
92-
'<dd class="property public"><span class="t_modifier_public">public</span> <span class="property-name">debug</span> <span class="t_operator">=</span> <span class="t_object" data-accessible="public"><span class="t_classname"><span class="namespace">bdk\</span>Debug</span> <span class="excluded">(not inspected)</span></span></dd>',
92+
'<dd class="property public"><span class="t_modifier_public">public</span> <span class="property-name">debug</span> <span class="t_operator">=</span> <span class="t_object" data-accessible="public"><span class="t_classname"><span class="namespace">bdk\</span>Debug</span>',
93+
'<span class="excluded">(not inspected)</span></span></dd>',
9394
'<dd class="property public"><span class="t_modifier_public">public</span> <span class="property-name">instance</span> <span class="t_operator">=</span> <span class="t_object" data-accessible="private"><span class="t_classname"><span class="namespace">bdk\DebugTest\</span>Test</span> <span class="t_recursion">*RECURSION*</span></span></dd>',
9495
'<dd class="property public"><span class="t_modifier_public">public</span> <span class="property-name" title="Public Property.">propPublic</span> <span class="t_operator">=</span> <span class="t_string">redefined in Test (public)</span></dd>',
9596
'<dd class="property public"><span class="t_modifier_public">public</span> <span class="property-name">propStatic</span> <span class="t_operator">=</span> <span class="t_string">I\'m Static</span></dd>',

0 commit comments

Comments
 (0)