Dear Maintainer,
after upgrading to Debian 12, Horde stopped working. It logs messages like:
PHP Fatal error: Uncaught ValueError: fread(): Argument #2 ($length) must be greater than 0 in /usr/share/php/Net/DNS2/Cache/File.php:142
Stack trace:
#0 /usr/share/php/Net/DNS2/Cache/File.php(142): fread()
#1 [internal function]: Net_DNS2_Cache_File->__destruct()
#2 {main}
thrown in /usr/share/php/Net/DNS2/Cache/File.php on line 142, referer: https://localhost/horde/imp/dynamic.php?page=mailbox
It's a known bug of Net_DNS2, already fixed upstream.
A quick fix:
--- /usr/share/php/Net/DNS2/Cache/File.php- 2020-10-19 22:19:24.000000000 +0200
+++ /usr/share/php/Net/DNS2/Cache/File.php 2023-07-28 14:41:16.342298660 +0200
@@ -139,7 +139,11 @@
//
// read the file contents
//
- $data = @fread($fp, filesize($this->cache_file));
+ $data = false;
+ $file_size = @filesize($this->cache_file);
+ if ( ($file_size !== false) && ($file_size > 0) ) {
+ $data = @fread($fp, $file_size);
+ }
if ( ($data !== false) && (strlen($data) > 0) ) {
//