FreeBSD Bugzilla – Attachment 233889 Details for
Bug 263924
dns/pear-Net_DNS2: upgrade to 1.5.2 to make usable with PHP-8
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Upgrade to 1.5.2
dns_pear-Net_DNS2.diff (text/plain), 6.07 KB, created by
Thierry Thomas
on 2022-05-13 10:58:46 UTC
(
hide
)
Description:
Upgrade to 1.5.2
Filename:
MIME Type:
Creator:
Thierry Thomas
Created:
2022-05-13 10:58:46 UTC
Size:
6.07 KB
patch
obsolete
>From ec80671363edc64823c5bd0112068904d196a126 Mon Sep 17 00:00:00 2001 >From: Thierry Thomas <thierry@FreeBSD.org> >Date: Wed, 11 May 2022 17:18:30 +0200 >Subject: [PATCH] dns/pear-Net_DNS2: upgrade to 1.5.2 > >Version 1.5.0 produces errors when used with PHP-8: > >PHP Fatal error: Uncaught ValueError: fread(): Argument #2 ($length) must be greater than 0 in /usr/local/share/pear/Net/DNS2/Cache/File. > >It has been fixed in 1.5.2. >--- > dns/pear-Net_DNS2/Makefile | 7 +- > dns/pear-Net_DNS2/distinfo | 6 +- > .../files/patch-Net_DNS2_Cache_File.php | 87 +++++++++++++++++++ > .../files/patch-Net_DNS2_Cache_Shm.php | 16 ++++ > 4 files changed, 112 insertions(+), 4 deletions(-) > create mode 100644 dns/pear-Net_DNS2/files/patch-Net_DNS2_Cache_File.php > create mode 100644 dns/pear-Net_DNS2/files/patch-Net_DNS2_Cache_Shm.php > >diff --git a/dns/pear-Net_DNS2/Makefile b/dns/pear-Net_DNS2/Makefile >index 53a98723488b..0e932d999ebf 100644 >--- a/dns/pear-Net_DNS2/Makefile >+++ b/dns/pear-Net_DNS2/Makefile >@@ -1,7 +1,8 @@ > # Created by: Wen Heping <wen@FreeBSD.org> > > PORTNAME= Net_DNS2 >-PORTVERSION= 1.5.0 >+PORTVERSION= 1.5.2 >+DISTVERSIONPREFIX= v > CATEGORIES= dns net pear > > MAINTAINER= sunpoet@FreeBSD.org >@@ -12,6 +13,10 @@ LICENSE_FILE= ${WRKSRC}/LICENSE > > USES= pear > >+USE_GITHUB= yes >+GH_ACCOUNT= mikepultz >+GH_PROJECT= netdns2 >+ > NO_ARCH= yes > > .include <bsd.port.mk> >diff --git a/dns/pear-Net_DNS2/distinfo b/dns/pear-Net_DNS2/distinfo >index 5b71ad1f1e28..30c10f416e72 100644 >--- a/dns/pear-Net_DNS2/distinfo >+++ b/dns/pear-Net_DNS2/distinfo >@@ -1,3 +1,3 @@ >-TIMESTAMP = 1620438069 >-SHA256 (PEAR/Net_DNS2-1.5.0.tgz) = 6b2157757aa7d388694ffb3e224da63580e7a3382b6473b3e51ad4d8f2dde3ff >-SIZE (PEAR/Net_DNS2-1.5.0.tgz) = 81188 >+TIMESTAMP = 1652279368 >+SHA256 (PEAR/mikepultz-netdns2-v1.5.2_GH0.tar.gz) = a1cada39b33afbbc8f0d9b998068485d85acb73a4c8c1681aab009604680a1ce >+SIZE (PEAR/mikepultz-netdns2-v1.5.2_GH0.tar.gz) = 83947 >diff --git a/dns/pear-Net_DNS2/files/patch-Net_DNS2_Cache_File.php b/dns/pear-Net_DNS2/files/patch-Net_DNS2_Cache_File.php >new file mode 100644 >index 000000000000..0add168e4380 >--- /dev/null >+++ b/dns/pear-Net_DNS2/files/patch-Net_DNS2_Cache_File.php >@@ -0,0 +1,87 @@ >+--- Net/DNS2/Cache/File.php.orig 2020-10-11 17:33:54 UTC >++++ Net/DNS2/Cache/File.php >+@@ -44,10 +44,17 @@ class Net_DNS2_Cache_File extends Net_DNS2_Cache >+ // >+ // check that the file exists first >+ // >+- if ( ($this->cache_opened == false) >+- && (file_exists($this->cache_file) == true) >+- && (filesize($this->cache_file) > 0) >+- ) { >++ if ( ($this->cache_opened == false) && (file_exists($this->cache_file) == true) ) { >++ >++ // >++ // check the file size >++ // >++ $file_size = filesize($this->cache_file); >++ if ( ($file_size === false) || ($file_size <= 0) ) { >++ >++ return; >++ } >++ >+ // >+ // open the file for reading >+ // >+@@ -62,7 +69,7 @@ class Net_DNS2_Cache_File extends Net_DNS2_Cache >+ // >+ // read the file contents >+ // >+- $data = fread($fp, filesize($this->cache_file)); >++ $data = fread($fp, $file_size); >+ >+ $decoded = null; >+ >+@@ -137,29 +144,39 @@ class Net_DNS2_Cache_File extends Net_DNS2_Cache >+ fseek($fp, 0, SEEK_SET); >+ >+ // >+- // read the file contents >+- // >+- $data = @fread($fp, filesize($this->cache_file)); >+- if ( ($data !== false) && (strlen($data) > 0) ) { >++ // get the file size first; in PHP 8.0 fread() was changed to throw an exception if you try >++ // and read 0 bytes from a file. >++ // >++ $file_size = @filesize($this->cache_file); >+ >++ if ( ($file_size !== false) && ($file_size > 0) ) { >++ >+ // >+- // unserialize and store the data >++ // read the file contents >+ // >+- $c = $this->cache_data; >++ $data = @fread($fp, $file_size); >++ >++ if ( ($data !== false) && (strlen($data) > 0) ) { >+ >+- $decoded = null; >++ // >++ // unserialize and store the data >++ // >++ $c = $this->cache_data; >+ >+- if ($this->cache_serializer == 'json') { >++ $decoded = null; >+ >+- $decoded = json_decode($data, true); >+- } else { >++ if ($this->cache_serializer == 'json') { >+ >+- $decoded = unserialize($data); >+- } >++ $decoded = json_decode($data, true); >++ } else { >++ >++ $decoded = unserialize($data); >++ } >+ >+- if (is_array($decoded) == true) { >++ if (is_array($decoded) == true) { >+ >+- $this->cache_data = array_merge($c, $decoded); >++ $this->cache_data = array_merge($c, $decoded); >++ } >+ } >+ } >+ >diff --git a/dns/pear-Net_DNS2/files/patch-Net_DNS2_Cache_Shm.php b/dns/pear-Net_DNS2/files/patch-Net_DNS2_Cache_Shm.php >new file mode 100644 >index 000000000000..0c08d0e39ba2 >--- /dev/null >+++ b/dns/pear-Net_DNS2/files/patch-Net_DNS2_Cache_Shm.php >@@ -0,0 +1,16 @@ >+--- Net/DNS2/Cache/Shm.php.orig 2020-10-11 17:33:54 UTC >++++ Net/DNS2/Cache/Shm.php >+@@ -254,7 +254,12 @@ class Net_DNS2_Cache_Shm extends Net_DNS2_Cache >+ // >+ // close the segment >+ // >+- shmop_close($this->_cache_id); >++ // shmop_close() is deprecated in v8.0.0 >++ // >++ if (version_compare(PHP_VERSION, '8.0.0', '<') == true) >++ { >++ shmop_close($this->_cache_id); >++ } >+ >+ // >+ // unlock >-- >2.36.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 263924
:
233856
|
233879
|
233889
|
233894