Skip to content

Conversation

@lukasbestle
Copy link
Member

@lukasbestle lukasbestle commented Apr 4, 2020

Describe the PR

file_get_contents() is not really meant for HTTP requests and therefore unreliable with some remote servers. Switching to cURL with our Remote class should make the requests more reliable.

Thanks for the suggestion @rasteiner.

Related issues

Ready?

  • Added unit tests for fixed bug/feature
  • Passing all unit tests
  • Fixed code style issues with CS fixer and composer fix
  • Added in-code documentation (if needed)

@lukasbestle lukasbestle added this to the 3.4.0 milestone Apr 4, 2020
@lukasbestle lukasbestle self-assigned this Apr 4, 2020
@afbora
Copy link
Member

afbora commented Apr 4, 2020

I agreed with @nilshoerrmann. What if we put into try catch block?

@lukasbestle
Copy link
Member Author

@afbora I agreed with @nilshoerrmann. What if we put into try catch block?

The example you posted in #2330 (comment) doesn't do anything unfortunately as it interrupts the Exception chain only to start a new one. try {} catch {} is for handling errors (basically for stopping the Exceptions from bubbling up), not for triggering errors.

Also, as I explained in my answer to Nils' comment above, file_get_contents() only triggers PHP warnings, which can't be caught by try {} catch {}.

But I think my new solution works quite well to ensure that the Panel shows errors for common issues.

@lukasbestle lukasbestle force-pushed the fix/2330-options-api-curl branch from 18eee64 to c374ef8 Compare April 5, 2020 11:53
@lukasbestle lukasbestle linked an issue Apr 5, 2020 that may be closed by this pull request
@bastianallgeier bastianallgeier merged commit 042058a into develop May 4, 2020
@bastianallgeier bastianallgeier deleted the fix/2330-options-api-curl branch May 4, 2020 11:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Multiselect: better failure handling for options from API

5 participants