Skip to content

[FrameworkBundle] don't register some AssetMapper services without configured HTTP clients #57219

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
wants to merge 1 commit into from

Conversation

xabbuh
Copy link
Member

@xabbuh xabbuh commented May 29, 2024

Q A
Branch? 6.4
Bug fix? yes
New feature? no
Deprecations? no
Issues see #57073 (comment)
License MIT

@ruudk
Copy link
Contributor

ruudk commented May 29, 2024

I'm not sure if this is the way to do it to be honest.

If I understand it correctly, when http_client is disabled, those services no longer register. That means that those functionality will not work anymore.

While with my PR, I did not inject the default http_client but instead, let the service class in question create it's own HttpClient.

I think this PR will actually break things for people that have http_client disabled.

@ruudk
Copy link
Contributor

ruudk commented May 29, 2024

Another solution is to do the following:

If the http_client service exists, use and inject that. Otherwise, create a new HttpClient service and inject it inline.

The AssetMapper component already requires HttpClient. But on the Framework level, there is no guarantee that the http_client is registered (because it was disabled).

@xabbuh
Copy link
Member Author

xabbuh commented May 29, 2024

I think this PR will actually break things for people that have http_client disabled.

Not sure about that, those service have already been unusable before as you pointed out in your PR. So this doesn't change here.

@ruudk
Copy link
Contributor

ruudk commented May 29, 2024

That's right, it was already broken indeed.

Solving it like this would be the way to go if you ask me: #57219 (comment)

Instead of removing the functionality that produced an error, it would solve the functionality, without needing addition work for the user.

@xabbuh xabbuh changed the title [FrameworkBundle] don't register some AssetMapper services with no configured HTTP clients [FrameworkBundle] don't register some AssetMapper services without configured HTTP clients May 30, 2024
@smnandre
Copy link
Member

smnandre commented Jun 4, 2024

If the http_client service exists, use and inject that. Otherwise, create a new HttpClient service and inject it inline.

@xabbuh what do you about this ?

I can create a PR in this direction if you want

(as asset-mapper does require http-client as direct dependency, it would allow to fix things for everyone.... or am i beeing naive here ?)

nicolas-grekas added a commit that referenced this pull request Jun 28, 2024
…se asset-mapper while http-client is disabled (nicolas-grekas)

This PR was merged into the 6.4 branch.

Discussion
----------

[FrameworkBundle] Throw runtime exception when trying to use asset-mapper while http-client is disabled

| Q             | A
| ------------- | ---
| Branch?       | 6.4
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        | -
| License       | MIT

Replaces #57219 and #57073

Commits
-------

df133a9 [FrameworkBundle] Throw runtime exception when trying to use asset-mapper while http-client is disabled
@xabbuh xabbuh deleted the pr-57073 branch June 28, 2024 09:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants