Commit aa6695e
fix(SecureViewService): handle fopen() returning false for non-existent paths
When shouldSecure() is called with tryOpen=true on a path that does not
exist yet (e.g. a rename target or a files_versions snapshot path), the
underlying fopen() call returns false. Calling fclose(false) on that
value throws a TypeError in PHP 8, which propagates as an uncaught
exception and aborts the entire DAV operation with HTTP 500.
To reproduce: enable Secure View watermarking for a group, add your
user to that group, then rename or overwrite any Office document. The
rename fails immediately with HTTP 500 and the following error appears
in nextcloud.log:
fclose(): Argument #1 ($stream) must be of type resource, bool given
in …/richdocuments/lib/Service/SecureViewService.php:37
Signed-off-by: Christoph Schaefer <christoph.schaefer@nextcloud.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>1 parent d79b884 commit aa6695e
1 file changed
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
37 | 43 | | |
38 | 44 | | |
39 | 45 | | |
| |||
0 commit comments