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

Doctor: allow_url_fopen and curl_multi_exec() #4740

Closed
3 tasks done
joho1968 opened this issue Apr 3, 2024 · 5 comments · Fixed by #4749
Closed
3 tasks done

Doctor: allow_url_fopen and curl_multi_exec() #4740

joho1968 opened this issue Apr 3, 2024 · 5 comments · Fixed by #4749
Labels
Milestone

Comments

@joho1968
Copy link
Contributor

joho1968 commented Apr 3, 2024

Describe the issue

Under Doctor > PHP, you may want to check for the PHP setting allow_url_fopen, and show a warning if it's disabled.

Also under Doctor > PHP, you may want to check if curl_multi_exec() exists. We lock down our environments quite a bit by disabling a number of functions. Currently it throws and exception if I go to System > Plugins. The exception is

Exception Error: "Call to undefined function Symfony\Component\HttpClient\Response\curl_multi_exec()" at CurlResponse.php line 284

You may also want to change the word Doctor to Health or Health check.

The documentation / installation instructions should probably mention these two.

I already tried

Kimai version

2.13.0

How do you run Kimai?

Virtual Server or alike

Which PHP version are you using?

8.1

Logfile

No response

Screenshots

No response

@joho1968 joho1968 added the bug label Apr 3, 2024
@kevinpapst
Copy link
Member

Thanks for sharing.
Can you share where allow_url_fopen is used?

@kevinpapst kevinpapst added this to the 2.15.0 milestone Apr 4, 2024
@joho1968
Copy link
Contributor Author

joho1968 commented Apr 4, 2024

Can you share where allow_url_fopen is used?

Sorry, my bad. I had that in the note text, but apparently did not copy it 🙄

If allow_url_fopen is disabled, this appears in the log:

[2024-04-04 14:55:48] [php] WARNING: Warning: file_get_contents(https://api.github.com/repos/kimai/kimai/releases): Failed to open stream: no suitable wrapper could be found {"exception":"[object] (ErrorException(code: 0): Warning: file_get_contents(https://api.github.com/repos/kimai/kimai/releases): Failed to open stream: no suitable wrapper could be found at /kimai/src/Utils/ReleaseVersion.php:43)"} []

[2024-04-04 14:55:48] [php] WARNING: Warning: file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 {"exception":"[object] (ErrorException(code: 0): Warning: file_get_contents(): https:// wrapper is disabled in the server configuration by allow_url_fopen=0 at /kimai/src/Utils/ReleaseVersion.php:43)"} []

@kevinpapst
Copy link
Member

Okay, so allow_url_fopen is used to find the latest Kimai version and the curl method to fetch the plugins.

Gracias 😄

@joho1968
Copy link
Contributor Author

joho1968 commented Apr 4, 2024

Why not simply write a function that checks if curl_multi_exec is available, if so use that, if not, check if allow_url_fopen is true/on, and if so, use that; and if none of them are available, display a warning on the "Health" (Doctor) screen ... 🤔

@kevinpapst
Copy link
Member

I cannot write custom code for every possible environment combination.
It is documented that curl is required. You decided to disable it anyway....

I am catching Throwables / RuntimeExceptions in the next release, so you will see the default error once every 24 hours:

image

Should be enough. Thanks for the report!

@kevinpapst kevinpapst mentioned this issue Apr 12, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

2 participants