What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Hi guys, the symfony web profiler bundle from version 4.4.11 does not work in the current suite. The

UKBF1R1S5
UKBF1R1S5 Posts: 34 🧑🏻‍🚀 - Cadet

Hi guys, the symfony web profiler bundle from version 4.4.11 does not work in the current suite. The reason for this is the following line: https://github.com/symfony/web-profiler-bundle/compare/v4.4.10...v4.4.11#diff-77fe531b58ebebb9b089a09099112ab7R425

Comments

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice

    Hi Daniel, is it about Zed?

  • giovanni.piemontese
    giovanni.piemontese Technical Lead @ Löffelhardt Spryker Solution Partner Posts: 871 🧑🏻‍🚀 - Cadet

    Hi, on my system too.. but only Zed does not work more... Any solution from Spryker Devs?

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice

    For Zed I reported this issue internally a month ago. It's still in the queue for our docker team with a medium prio.

  • giovanni.piemontese
    giovanni.piemontese Technical Lead @ Löffelhardt Spryker Solution Partner Posts: 871 🧑🏻‍🚀 - Cadet

    Ok.. thanks.. 🙂

  • UKBF1R1S5
    UKBF1R1S5 Posts: 34 🧑🏻‍🚀 - Cadet

    it is about zed

  • UKBF1R1S5
    UKBF1R1S5 Posts: 34 🧑🏻‍🚀 - Cadet

    A quick solution is to prepare the version constrain for symfony/web-profiler-bundle.

    "symfony/web-profiler-bundle": "<=4.4.10"
    
  • UKBF1R1S5
    UKBF1R1S5 Posts: 34 🧑🏻‍🚀 - Cadet

    The xhr request which is made by the symfony package is the problem.

    For example:
    Current url: http(s)://zed…/auth/login --> URL for xhr request http(s)://zed…/auth/_wdt?…

    The correct url for the xhr request must be http(s)://zed…/_wdt?…

  • UKBF1R1S5
    UKBF1R1S5 Posts: 34 🧑🏻‍🚀 - Cadet

    @valerii.trots i hope this information help your dev team.

  • Valerii Trots
    Valerii Trots SRE @ Spryker Sprykee Posts: 1,654 ✨ - Novice

    Thanks Daniel! I'll add this info into the ticket but the main concern here is the queue and resources that we don't have enough at the moment unfortunately.

  • Stanislav Matveyev
    Stanislav Matveyev Tech Lead @ Spryker Sprykee Posts: 211 🧑🏻‍🚀 - Cadet

    The issue in `

    Spryker\Zed\Gui\Communication\Plugin\Twig\UrlTwigPlugin
    

    it overrides url() Twig function by custom one used in Zed UI everywhere.

    Quick and dirty fix from me (until it will be fixed properly 😉 )

    namespace Spryker\Zed\Gui\Communication\Plugin\Twig;
    
    use Spryker\Service\Container\ContainerInterface;
    use Spryker\Service\UtilText\Model\Url\Url;
    use Spryker\Shared\TwigExtension\Dependency\Plugin\TwigPluginInterface;
    use Spryker\Zed\Kernel\Communication\AbstractPlugin;
    use Twig\Environment;
    use Twig\TwigFunction;
    
    /**
     * @method \Spryker\Zed\Gui\GuiConfig getConfig()
     * @method \Spryker\Zed\Gui\Communication\GuiCommunicationFactory getFactory()
     */
    class UrlTwigPlugin extends AbstractPlugin implements TwigPluginInterface
    {
        public const FUNCTION_NAME_URL = 'url';
    
        /**
         * {@inheritDoc}
         * - Extends twig with "url" function to parse and generate URLs based on URL parts.
         *
         * @api
         *
         * @param \Twig\Environment $twig
         * @param \Spryker\Service\Container\ContainerInterface $container
         *
         * @return \Twig\Environment
         */
        public function extend(Environment $twig, ContainerInterface $container): Environment
        {
            $twig->addFunction($this->getUrlFunction($container));
    
            return $twig;
        }
    
        /**
         * @return \Twig\TwigFunction
         */
        protected function getUrlFunction(ContainerInterface $container): TwigFunction
        {
            return new TwigFunction(static::FUNCTION_NAME_URL, function (string $url, array $query = [], array $options = []) use ($container) {
                if ($url === '_wdt' || strpos($url, '_profile') !== false) {
                    /** @var \Symfony\Cmf\Component\Routing\ChainRouter $globalUrlGenerator */
                    $globalUrlGenerator = $container->get('url_generator');
                    $url = $globalUrlGenerator->generate($url, $query);
    
                    $charset = mb_internal_encoding() ?: 'UTF-8';
                    return htmlspecialchars($url, ENT_QUOTES | ENT_SUBSTITUTE, $charset);
                }
    
                $url = Url::generate($url, $query, $options);
    
                return $url->buildEscaped();
            }, ['is_safe' => ['html']]);
        }
    }