Giter Site home page Giter Site logo

Comments (4)

JPustkuchen avatar JPustkuchen commented on May 30, 2024 1

@jnvsor WHAO, you're Speedy Gonzales! Fastest mouse in Mexico 🚀
(No idea if that cartoon has the same name anywhere in the world, like in Germany xD)

Yes, perfect! Working just fine, thanks for the lightning fast fix!

from kint.

jnvsor avatar jnvsor commented on May 30, 2024

Should be fixed in 055630e

from kint.

JPustkuchen avatar JPustkuchen commented on May 30, 2024

Thanks @jnvsor,

we're using 5.0.6 and the issue still appears. I guess it should be fixed in this version?
For us it happens in Drupal 10.

The partial backtrace is:

TypeError: Cannot assign stdClass to reference held by property Symfony\Component\HttpFoundation\Session\Flash\FlashBag::$flashes of type array in Kint\Parser\Parser->parseArray() (line 377 of /vendor/kint-php/kint/src/Parser/Parser.php).

Kint\Parser\Parser->parse() (Line: 565)
Kint\Parser\Parser->parseObject() (Line: 138)
Kint\Parser\Parser->parse() (Line: 565)
Kint\Parser\Parser->parseObject() (Line: 138)
Kint\Parser\Parser->parse() (Line: 565)
Kint\Parser\Parser->parseObject() (Line: 138)
Kint\Parser\Parser->parse() (Line: 565)
Kint\Parser\Parser->parseObject() (Line: 138)
Kint\Parser\Parser->parse() (Line: 285)
Kint\Kint->dumpVar() (Line: 268)
Kint\Kint->dumpAll() (Line: 575)
Kint\Kint::dump() (Line: 64)
Drupal\devel\Plugin\Devel\Dumper\Kint->export() (Line: 105)
Drupal\devel\DevelDumperManager->export() (Line: 115)
Drupal\devel\DevelDumperManager->message() (Line: 183)
Drupal\devel\Twig\Extension\Debug->message() (Line: 44)
__TwigTemplate_1bb3a20a3f4847fc1af463271334acbf->doDisplay() (Line: 394)
Twig\Template->displayWithErrorHandling() (Line: 367)
Twig\Template->display() (Line: 379)
Twig\Template->render() (Line: 40)
Twig\TemplateWrapper->render() (Line: 53)
twig_render_template() (Line: 372)

Does that help?

Seems like it appeared with the Drupal 10 Upgrade which uses Symfony 6.2. With Drupal 9 we never had that issue before. Should this be reopened?

from kint.

jnvsor avatar jnvsor commented on May 30, 2024

While it seems obvious, you can't assign a value to a reference of a typed property of the wrong type. Since copying arrays and assigning instances to each member was how we detected references all I had to do was throw a try catch around it to stop it failing on every object with a typed property.

I didn't realize someone could throw a reference to a typed property into an array and pass that into kint (Even though that's basically what kint is doing itself...) so we basically had to do the same thing for arrays too.

Please confirm that this works @JPustkuchen


Example code

<?php

class test {
    public int $v;
}

$t = new test();
$t->v = 4;

$a['val'] = &$t->v;

$a['val'] = 'test';

from kint.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.