-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Fix file_get_content signatures to make it clear it can return false #37943
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
Conversation
In File::getContent, which must return a string, throw an Exception instead of returning false. Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
|
Hello! Are you familiar with our documentation process already? Changes that affect administrators should be documented here: While I understand sometimes it's handy to merge fast to get your changes in, it would be great if next time you could try to add the documentation before merging. You can find more information on that here: If all your documentation efforts are done, please remove the label 'documentation' and check the checkbox in your opening note and I'll stop bugging you :) Many thanks in advance and thanks again for your work! |
|
Problem still present in 26.0.3rc2 |
This PR was not backported to 26. |
|
Have applied as workaround (until v27 is available) this patch from master and it's working now. https://github.com/nextcloud/server/commit/997efe44ffd56959f198be2e3aa71687a2f11412 |
|
Hello, I made an update to 27.0.2 yesterday and since then I have the GenericFileException error. Unfortunately I do not know what to do. Can someone help me with this?
GET /index.php/apps/files/ |
|
Found the solution: |
|
My nextcloud setup is tracking the stable branch and currently only offers 25.0.13 as most recent version. Any chance this fix will be backported to that version ? For now I have manually applied part of the patch to lib/private/Files/Node/File.php and that seems to work, but I hope I don't have to continue applying these until the stable channel offers me an upgrade to 27.0.x. |
Are you on PHP 7.4 by any chance? That may explain why the update to 26 is not offered to you, you need to update PHP to a supported version first I think. |
|
I'm indeed still on PHP7.4. I had seen the warnings in the admin panel but didn't realize those were actually preventing further upgrades. Thanks for pointing that out, I'll go and upgrade PHP first. |
In case anyone else gets here with the same question I had, upgrading PHP did indeed result in nextcloud offering upgrades to newer releases again. Thanks @come-nc for the pointer. |
File.getContent can throw a GenericFileException since #37943. Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
File.getContent can throw a GenericFileException since nextcloud#37943. Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
File.getContent can throw a GenericFileException since nextcloud#37943. Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>

Summary
In File::getContent, which must return a string, throw an Exception instead of returning false.
This avoids some TypeError that I’ve seen reported recently, either through SimpleFile which has a strong return type, or through a call to getimagesizefromstring which expects a string.
Checklist