Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Dump function from 3.4.5 produces ugly result #26640

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

Closed
ahilles107 opened this issue Mar 22, 2018 · 19 comments
Closed

Dump function from 3.4.5 produces ugly result #26640

ahilles107 opened this issue Mar 22, 2018 · 19 comments

Comments

@ahilles107
Copy link

Q A
Bug report? yes
Feature request? no
BC Break report? yes
RFC? no
Symfony version 3.4.5

After updating symfony to 3.4.5 (from 3.4.4) i get ugly (simple) dumps from twig templates.

3.4.4 result:
zrzut ekranu 2018-03-22 o 18 16 46

3.4.5 result:
zrzut ekranu 2018-03-22 o 18 18 45

Dump's from php files (controller, listener) looks ok. Only twig is affected. Switching back to 3.4.4 solves issue. 3.4.6 is also affected.

@ahilles107
Copy link
Author

[Solved] For some reason twig dump (Twig_Extension_Debug) extension from 3.4.5 is more important that var-dumper. IMO it can be treated as BC break.

We had Twig_Extension_Debug enabled in project and so far it was ignored. From 3.4.5 it's loaded instead var-dumper.

services:
    twig.extension.debug:
        class: Twig_Extension_Debug
        tags:
                - { name: 'twig.extension' }

Maybe it's connected to #25756 ?

@xabbuh
Copy link
Member

xabbuh commented Mar 22, 2018

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

@ahilles107
Copy link
Author

Hey, you need repo with example? It's very simple i reproduce it with:

symfony new test_dump 3.4.4 in app/Resources/views/base.html.twig i added {{ dump(app.request) }}. Then in app/config/services.yml i added to services section:

    twig.extension.debug:
        class: Twig_Extension_Debug
        tags:
                - { name: 'twig.extension' }

Now it renders dump ok. When i change in composer.json "symfony/symfony": "3.4.4", to "symfony/symfony": "3.4.5", and call composer update --prefer-dist --prefer-stable after installation dump is wrong (rendered by Twig_Extension_Debug). Looks like with var-dump we don't need this extension anymore, but it SF shouldn't change so much in minor release.

@fancyweb
Copy link
Contributor

Status: Reviewed

Indeed, @ahilles107 is right. I tested it.

Twig_Extension_Debug extension and Symfony\Bridge\Twig\Extension\DumpExtension extension both define the Twig dump function.
Before #25756, Twig_Extension_Debug was initialized first, so the dump function was replaced when Symfony\Bridge\Twig\Extension\DumpExtension was loaded just after.
Now it's just the contrary.

@fancyweb
Copy link
Contributor

BTW, the output you get now is normal since the Twig_Extension_Debug extension dump function is basically a var_dump. That's the "ugly" thing we had before the VarDumper component ^^

Also, I'm not sure if it can be considered as a true BC break, since the Twig_Extension_Debug extension dump function was simply never used before in your case. It looks like a wrong usage. Or maybe am I missing something ?

@ahilles107
Copy link
Author

@fancyweb - you are right, we don't use Twig_Extension_Debug in this project from long time but it was still declared in services (our fault). But we talk here about minor release and changed behaviour of framework.

@ahilles107
Copy link
Author

And it's quite hard to debug as it looks like some new simple formatter in VarDumper as nothing changed in the place where it's called. I started checking this from reading VarDumper, twig, and bridges changelogs.

@fancyweb
Copy link
Contributor

About the BC break, it is one. There is no doubt about it. However, I have learned that when you use Symfony, if your code is working by chance and that it breaks later as a side effect of something else, it might not always be considered as true BC break. Let's wait for a member opinion.

@xabbuh
Copy link
Member

xabbuh commented Mar 23, 2018

To me it's a BC break too.

@pmontoya
Copy link

pmontoya commented Apr 6, 2018

Can I take this one?

@nicolas-grekas
Copy link
Member

@pmontoya please do!

@ahilles107
Copy link
Author

Hey, any progress here @pmontoya?

@fancyweb
Copy link
Contributor

@ahilles107 Why don't you just remove your "twig.extension.debug" service ?

@ahilles107
Copy link
Author

@fancyweb i solved it in first comment to this issue. But it's still BC'break, and I'm looking at this issue from time to time.

@javiereguiluz
Copy link
Member

@pmontoya are you still interested in fixing this bug ... or do you prefer to "release" it so others can take it over? Thanks!

@pmontoya
Copy link

@javiereguiluz : Sorry, I forgot this issue. I'll work on it tomorrow.

@pmontoya
Copy link

I'm sorry but without using the 4.1 feature with twig extension priority, I don't see how to fix this BC Break without removing #25756 changes

@fancyweb
Copy link
Contributor

That's what I'm trying to say since the beginning of this issue. Also does it really worth it to fix this regression 18 patches versions later ? 🤔

@Simperfit
Copy link
Contributor

@nicolas-grekas @fancyweb what can we do about this ?

@fabpot fabpot closed this as completed Aug 6, 2019
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