Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webprofiler "Argument 2 passed to Symfony\Bundle\WebProfilerBundle\Twig\WebProfilerExtension::dumpData()" error #24804

Closed
millnut opened this issue Nov 3, 2017 · 17 comments

Comments

@millnut
Copy link

millnut commented Nov 3, 2017

Q A
Bug report? yes
Feature request? no
BC Break report? yes
RFC? no
Symfony version 4.0.0-BETA2

Using Symfony Flex with version 4.0.0-BETA2 with the composer.json below, when logging in or as anonymous and trying to access the doctrine section or security section of the web profiler returns the following error for both (all other sections are fine)

Type error: Argument 2 passed to Symfony\Bundle\WebProfilerBundle\Twig\WebProfilerExtension::dumpData() must be an instance of Symfony\Component\VarDumper\Cloner\Data, null given, called in /beta2/var/cache/dev/twig/01/0179a685ace86281d0a70ef66f92ed078b595a533f89935addc2d2832b7b3795.php on line 749

Type error: Argument 2 passed to Symfony\Bundle\WebProfilerBundle\Twig\WebProfilerExtension::dumpData() must be an instance of Symfony\Component\VarDumper\Cloner\Data, array given, called in /beta2/var/cache/dev/twig/48/48b45b978a28ff1cde1082d35a927d1cd986704029abdd25b28918c42e0516fe.php on line 630

Composer.json

{
    "type": "project",
    "license": "proprietary",
    "minimum-stability": "beta",
    "require": {
        "php": "^7.1.8",
        "sensio/framework-extra-bundle": "^5.0",
        "symfony/asset": "^4.0@beta",
        "symfony/console": "^4.0",
        "symfony/expression-language": "^4.0@beta",
        "symfony/flex": "^1.0",
        "symfony/form": "^4.0@beta",
        "symfony/framework-bundle": "^4.0",
        "symfony/lts": "^4@dev",
        "symfony/monolog-bundle": "^3.1",
        "symfony/orm-pack": "^1.0",
        "symfony/requirements-checker": "^1.0",
        "symfony/security-bundle": "^4.0@beta",
        "symfony/swiftmailer-bundle": "^3.1",
        "symfony/translation": "^4.0@beta",
        "symfony/twig-bundle": "^4.0@beta",
        "symfony/validator": "^4.0@beta",
        "symfony/yaml": "^4.0",
        "twig/extensions": "^1.5"
    },
    "require-dev": {
        "symfony/debug-bundle": "^4.0@beta",
        "symfony/dotenv": "^4.0",
        "symfony/profiler-pack": "^1.0",
        "symfony/var-dumper": "^4.0@beta"
    },
    "config": {
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true
    },
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/"
        }
    },
    "scripts": {
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install --symlink --relative %PUBLIC_DIR%": "symfony-cmd",
            "requirements-checker": "script"
        },
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ]
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "extra": {
        "symfony": {
            "id": "01BWT9DKN35141YD3CV7D3FD34",
            "allow-contrib": false
        }
    }
}
@mikaint
Copy link

mikaint commented Nov 3, 2017

I have the same issue. Can't use profiler.

@xabbuh
Copy link
Member

xabbuh commented Nov 3, 2017

Can one of you create a small example project that allows to reproduce your issue?

@millnut
Copy link
Author

millnut commented Nov 3, 2017

@xabbuh Yep I should be able to create one later this evening once out of work

@millnut
Copy link
Author

millnut commented Nov 3, 2017

@xabbuh had some free time testcase is here https://github.com/limitstudios/beta2test

Security webprofiler error is very touch and go whether it happens

The doctrine webprofiler error happens logged in or out; or any section with database interaction; I have also added the test login in the README

@xabbuh
Copy link
Member

xabbuh commented Nov 3, 2017

Thanks for providing the example. However, this does work for me. The only thing I changed locally was to use SQLite instead of MySQL. Can you debug what is tried to be dumped when you get this error?

@millnut
Copy link
Author

millnut commented Nov 3, 2017

@xabbuh Yep I used MySQL I will get the exact version tomorrow. How would I go about getting the dump contents would the contents of the stack trace be enough? It’s quite large so do you want as a text or attached as a file?

@xabbuh
Copy link
Member

xabbuh commented Nov 3, 2017

You could create a gist and link to it here.

If you want to debug this yourself, I suggest to configure Xdebug and add a breakpoint that would allow you to inspect what is going on.

@ad3n
Copy link

ad3n commented Nov 4, 2017

Yes... I have same issue

@gogus
Copy link

gogus commented Nov 5, 2017

I have the same issue.

@ogizanagi
Copy link
Member

Could any of you try to identify which of the profiler_dump calls cause this in both https://github.com/symfony/symfony/blob/master/src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/security.html.twig and https://github.com/doctrine/DoctrineBundle/blob/master/Resources/views/Collector/db.html.twig#L241 and what is the data we're actually trying to dump?

Might be the same issue as in #23050

@ogizanagi
Copy link
Member

ogizanagi commented Nov 5, 2017

Could you try #24829 please?
Regarding the doctrine panel, an issue should probably be opened in the DoctrineBundle repository.

@gogus
Copy link

gogus commented Nov 5, 2017

Created: doctrine/DoctrineBundle#730

@ogizanagi
Copy link
Member

Thanks @gogus! Does #24829 solve the issue regarding the security panel?

@gogus
Copy link

gogus commented Nov 6, 2017

For me the security panel was ok. I had only problem with doctrine.

@xabbuh
Copy link
Member

xabbuh commented Nov 6, 2017

@limitstudios @ad3n Can you check if #24829 fixes your issue?

fabpot added a commit that referenced this issue Nov 6, 2017
…rt decision.object being null (ogizanagi)

This PR was merged into the 3.3 branch.

Discussion
----------

[SecurityBundle] Fix the datacollector to properly support decision.object being null

| Q             | A
| ------------- | ---
| Branch?       | 3.3 <!-- see comment below -->
| Bug fix?      | yes
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md files -->
| Tests pass?   | yes
| Fixed tickets | #24804 <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | N/A

Similar to #23050, when accessing a `Data` clone property through `__get()` and the value is `null` for instance, you'll really get `null` instead of a `Data` instance. The solution is to use `seek` instead whenever we access and try to use `profiler_dump` on a `Data` property that can be a simple scalar like `null` or `false`. AFAIK, `decision.object` is the only one here.

Commits
-------

769a5f2 [SecurityBundle] Fix the datacollector to properly support decision.object being null
@fabpot fabpot closed this as completed Nov 6, 2017
@millnut
Copy link
Author

millnut commented Nov 6, 2017

@ogizanagi @xabbuh #24829 does fix the security panel error, I will keep an eye on doctrine/DoctrineBundle#730 for any further testing needed

@derrabus
Copy link
Member

derrabus commented Nov 8, 2017

Regarding the Doctrine panel, the exception is caused by the inclusion of WebProfilerBundle's table template:

https://github.com/doctrine/DoctrineBundle/blob/41d6b7c9a1a37e08ab1c321193446c12d6afb5ed/Resources/views/Collector/db.html.twig#L283

https://github.com/doctrine/DoctrineBundle/blob/41d6b7c9a1a37e08ab1c321193446c12d6afb5ed/Resources/views/Collector/db.html.twig#L293

As a side effect of #23056, the table cannot be used anymore on arrays of strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants