diff --git a/build/kint.phar b/build/kint.phar index ba7792035..f2d8265cb 100644 Binary files a/build/kint.phar and b/build/kint.phar differ diff --git a/src/Parser/Parser.php b/src/Parser/Parser.php index d658b0924..75781206b 100644 --- a/src/Parser/Parser.php +++ b/src/Parser/Parser.php @@ -34,6 +34,7 @@ use Kint\Zval\Value; use ReflectionObject; use stdClass; +use TypeError; class Parser { @@ -524,7 +525,11 @@ private function parseObject(&$var, Value $o) } $stash = $val; - $copy[$i] = $refmarker; + try { + $copy[$i] = $refmarker; + } catch (TypeError $e) { + $child->reference = true; + } if ($val === $refmarker) { $child->reference = true; $val = $stash; diff --git a/tests/Parser/ParserTest.php b/tests/Parser/ParserTest.php index 9d6f2994b..916662eb7 100644 --- a/tests/Parser/ParserTest.php +++ b/tests/Parser/ParserTest.php @@ -473,6 +473,18 @@ public function testParseReferences() $this->assertTrue($o->value->contents[0]->reference); $this->assertFalse($o->value->contents[1]->reference); $this->assertFalse($o->value->contents[2]->reference); + + if (KINT_PHP74) { + $propval = 'test'; + $v = new Php74TestClass(); + $v->b = &$propval; + + $o = $p->parse($v, clone $b); + + foreach ($o->value->contents as $val) { + $this->assertSame('b' === $val->name, $val->reference); + } + } } /**