api-platform / core

The server component of API Platform: hypermedia and GraphQL APIs in minutes
https://api-platform.com
MIT License
2.43k stars 868 forks source link

Broken Symfony Profiler when api-platform/core not installed #6709

Open ZZromanZZ opened 2 days ago

ZZromanZZ commented 2 days ago

API Platform version(s) affected: 4.0 (maybe even older)

Description

Error is occuring on loading Symfony Web Profiler Toolbar is shown with message An error occurred while loading the web debug toolbar.

How to reproduce

Install via Composer only with api-platform/symfony (not api-platform/core)

Possible Solution

ApiPlatform\Symfony\Bundle\DataCollector\RequestDataCollector::getVersion references api/platform/core to get its version, when changed to get version from api-platform/symfony, it works as expected

Additional Context

[2024-10-09T13:10:34.633853+02:00] request.CRITICAL: Uncaught PHP Exception Twig\Error\RuntimeError: "An exception has been thrown during the rendering of a template ("Package "api-platform/core" is not installed")." at request.html.twig line 86 {"exception":"[object] (Twig\\Error\\RuntimeError(code: 0): An exception has been thrown during the rendering of a template (\"Package \"api-platform/core\" is not installed\"). at /srv/app/v2/vendor/api-platform/symfony/Bundle/Resources/views/DataCollector/request.html.twig:86)\n[previous exception] [object] (OutOfBoundsException(code: 0): Package \"api-platform/core\" is not installed at /srv/app/v2/vendor/composer/InstalledVersions.php:203)"} []
DavidFeller commented 2 hours ago

I'm facing the same issue.