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

App script macros return Twig\Markup instance instead of actual return value #3680

Open
atloss opened this issue Apr 22, 2024 · 2 comments
Open
Labels

Comments

@atloss
Copy link

atloss commented Apr 22, 2024

PHP Version

8.2

Shopware Version

6.6.1.1

Expected behaviour

App script macros return the actual return value.

Actual behaviour

App script macros return Twig\Markup instance.

How to reproduce

  1. Create a valid app based on the app system with bin/console app:create
  2. Create an app script. E.g Resources/scripts/navigation-page-loaded/load-navigation-page.twig
  3. Use the following sample code for the load-navigation-page.twig script:
{% import 'include/loader.twig' as loader %}

{% set page = hook.page %}
{# @var page \Shopware\Storefront\Page\Navigation\NavigationPage #}

{% do loader.load() %}
  1. Next up create the Resources/scripts/include/loader.twig include with something like:
{# @var services \Shopware\Core\Framework\Script\ServiceStubs #}

{% macro load() %}
    {% set text = _self.sayHello() %}
    {% do debug.dump(text) %}
{% endmacro %}

{% macro sayHello() %}
    {% return "Hello World" %}
{% endmacro %}
  1. Expected behaviour: The macro function returns the Hello World string
  2. Actual behaviour: The macro function returns a Twig\Markup instance

Consequences: This results in crashing apps, since those macros don't return expected values anymore.

@atloss atloss added the Bug label Apr 22, 2024
@shopware-issue-bot
Copy link

We found the following existing issues which may help or are related to your topic:

@shyim
Copy link
Member

shyim commented Apr 23, 2024

We are working on it. in the meanwhile you can run

composer req shopware/conflicts:0.1.7 -W

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

No branches or pull requests

2 participants