git: 3f1b38acfda1 - main - www/phpvirtualbox{,-legacy}: PHP 8 support (1 more catch) - "preg_replace"

From: Vladimir Druzenko <vvd_at_FreeBSD.org>
Date: Mon, 18 Sep 2023 12:41:04 UTC
The branch main has been updated by vvd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=3f1b38acfda124fc8f03fe5f4edfef10ef214501

commit 3f1b38acfda124fc8f03fe5f4edfef10ef214501
Author:     Vladimir Druzenko <vvd@FreeBSD.org>
AuthorDate: 2023-09-18 12:35:49 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2023-09-18 12:39:54 +0000

    www/phpvirtualbox{,-legacy}: PHP 8 support (1 more catch) - "preg_replace"
    
    Fixed:
    PHP Warning: preg_replace() expects at least 3 parameters, 2 given in endpoints/screen.php on line 91
    
    PR:             261498
    Approved by:    tcberner (mentor)
    MFH:            2023Q3
---
 www/phpvirtualbox-legacy/Makefile  |  2 +-
 www/phpvirtualbox/Makefile         |  2 +-
 www/phpvirtualbox/files/patch-php8 | 28 +++++++++++++++++++++++++---
 3 files changed, 27 insertions(+), 5 deletions(-)

diff --git a/www/phpvirtualbox-legacy/Makefile b/www/phpvirtualbox-legacy/Makefile
index 38709462e376..ba80ba721ec8 100644
--- a/www/phpvirtualbox-legacy/Makefile
+++ b/www/phpvirtualbox-legacy/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	phpvirtualbox
 DISTVERSION=	5.2-1
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	www
 PKGNAMESUFFIX=	-legacy
 
diff --git a/www/phpvirtualbox/Makefile b/www/phpvirtualbox/Makefile
index 4c4929542c6f..cc67954d33a0 100644
--- a/www/phpvirtualbox/Makefile
+++ b/www/phpvirtualbox/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	phpvirtualbox
 DISTVERSION=	6.1
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	www
 
 MAINTAINER=	vbox@FreeBSD.org
diff --git a/www/phpvirtualbox/files/patch-php8 b/www/phpvirtualbox/files/patch-php8
index d6566684b8ca..477a1596ba4c 100644
--- a/www/phpvirtualbox/files/patch-php8
+++ b/www/phpvirtualbox/files/patch-php8
@@ -144,12 +144,34 @@ diff -ur endpoints/screen.php.orig endpoints/screen.php
  		// Let the browser cache images for 3 seconds
  		$ctime = 0;
 -		if(strpos($_SERVER['HTTP_IF_NONE_MATCH'],'_')) {
-+		if(strpos($_SERVER['HTTP_IF_NONE_MATCH'] ?? '','_')) {
- 			$ctime = preg_replace("/.*_/",str_replace('"','',$_SERVER['HTTP_IF_NONE_MATCH']));
+-			$ctime = preg_replace("/.*_/",str_replace('"','',$_SERVER['HTTP_IF_NONE_MATCH']));
 -		} else if(strpos($_ENV['HTTP_IF_NONE_MATCH'],'_')) {
+-			$ctime = preg_replace("/.*_/",str_replace('"','',$_ENV['HTTP_IF_NONE_MATCH']));
+-		} else if(strpos($_SERVER['HTTP_IF_MODIFIED_SINCE'],'GMT')) {
++		if(strpos($_SERVER['HTTP_IF_NONE_MATCH'] ?? '','_')) {
++			$ctime = preg_replace("/.*_/","",str_replace('"','',$_SERVER['HTTP_IF_NONE_MATCH']));
 +		} else if(strpos($_ENV['HTTP_IF_NONE_MATCH'] ?? '','_')) {
- 			$ctime = preg_replace("/.*_/",str_replace('"','',$_ENV['HTTP_IF_NONE_MATCH']));
++			$ctime = preg_replace("/.*_/","",str_replace('"','',$_ENV['HTTP_IF_NONE_MATCH']));
++		} else if(strpos($_SERVER['HTTP_IF_MODIFIED_SINCE'] ?? '','GMT')) {
+ 			$ctime = strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']);
+-		} else if(strpos($_ENV['HTTP_IF_MODIFIED_SINCE'],'GMT')) {
++		} else if(strpos($_ENV['HTTP_IF_MODIFIED_SINCE'] ?? '','GMT')) {
+ 			$ctime = strtotime($_ENV['HTTP_IF_MODIFIED_SINCE']);
+ 		}
+ 
+@@ -164,13 +164,13 @@
+ 
+ 		// Let the browser cache saved state images
+ 		$ctime = 0;
+-		if(strpos($_SERVER['HTTP_IF_NONE_MATCH'],'_')) {
+-			$ctime = preg_replace("/.*_/",str_replace('"','',$_SERVER['HTTP_IF_NONE_MATCH']));
+-		} else if(strpos($_ENV['HTTP_IF_NONE_MATCH'],'_')) {
+-			$ctime = preg_replace("/.*_/",str_replace('"','',$_ENV['HTTP_IF_NONE_MATCH']));
 -		} else if(strpos($_SERVER['HTTP_IF_MODIFIED_SINCE'],'GMT')) {
++		if(strpos($_SERVER['HTTP_IF_NONE_MATCH'] ?? '','_')) {
++			$ctime = preg_replace("/.*_/","",str_replace('"','',$_SERVER['HTTP_IF_NONE_MATCH']));
++		} else if(strpos($_ENV['HTTP_IF_NONE_MATCH'] ?? '','_')) {
++			$ctime = preg_replace("/.*_/","",str_replace('"','',$_ENV['HTTP_IF_NONE_MATCH']));
 +		} else if(strpos($_SERVER['HTTP_IF_MODIFIED_SINCE'] ?? '','GMT')) {
  			$ctime = strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']);
 -		} else if(strpos($_ENV['HTTP_IF_MODIFIED_SINCE'],'GMT')) {