[pkg-php-pear] Bug#1042457: php-net-dns2: incompatible with PHP 8.x: Uncaught ValueError: fread()

Ondrej Zary zary at gsystem.sk
Fri Jul 28 13:49:49 BST 2023


Package: php-net-dns2
Version: 1.5.0-1
Severity: grave
Tags: upstream
Justification: renders package unusable
X-Debbugs-Cc: zary at gsystem.sk

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) ) {

                 //

-- System Information:
Debian Release: 12.1
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'oldoldstable-updates'), (500, 'oldoldstable'), (500, 'stable'), (100, 'bookworm-fasttrack'), (100, 'bookworm-backports-staging')
Architecture: amd64 (x86_64)

Kernel: Linux 5.10.0-23-amd64 (SMP w/2 CPU threads)
Locale: LANG=en_US.UTF-8, LC_CTYPE=sk_SK.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages php-net-dns2 depends on:
ii  php-common  2:93

php-net-dns2 recommends no packages.

php-net-dns2 suggests no packages.

-- no debconf information



More information about the pkg-php-pear mailing list