git: a9c2430bd9f9 - main - net/phpldapadmin: Fix runtime with php80

From: Muhammad Moinur Rahman <bofh_at_FreeBSD.org>
Date: Mon, 07 Mar 2022 04:44:00 UTC
The branch main has been updated by bofh:

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

commit a9c2430bd9f97ff6bfcc2daf9a791f549a1d2f9b
Author:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
AuthorDate: 2022-03-07 04:40:55 +0000
Commit:     Muhammad Moinur Rahman <bofh@FreeBSD.org>
CommitDate: 2022-03-07 04:43:50 +0000

    net/phpldapadmin: Fix runtime with php80
    
    - Pet portclippy/portfmt
    
    PR:             261990
    Reported by:    ohartmann@walstatt.org
    Approved by:    ports@bsdserwis.com (maintainer)
    Sponsored by:   Bounce Experts
---
 net/phpldapadmin/Makefile                          |  8 +++-
 net/phpldapadmin/files/patch-htdocs_collapse.php   | 11 ++++++
 .../files/patch-htdocs_draw__tree__node.php        | 11 ++++++
 net/phpldapadmin/files/patch-htdocs_expand.php     | 11 ++++++
 net/phpldapadmin/files/patch-htdocs_refresh.php    | 11 ++++++
 net/phpldapadmin/files/patch-lib_Attribute.php     | 11 ++++++
 .../files/patch-lib_AttributeFactory.php           | 11 ++++++
 .../files/patch-lib_BinaryAttribute.php            | 11 ++++++
 net/phpldapadmin/files/patch-lib_DateAttribute.php | 10 +++++
 net/phpldapadmin/files/patch-lib_DnAttribute.php   | 10 +++++
 net/phpldapadmin/files/patch-lib_GidAttribute.php  | 10 +++++
 .../files/patch-lib_MultiLineAttribute.php         | 11 ++++++
 .../files/patch-lib_ObjectClassAttribute.php       | 10 +++++
 net/phpldapadmin/files/patch-lib_PageRender.php    | 31 ++++++++++++++++
 .../files/patch-lib_PasswordAttribute.php          | 10 +++++
 .../files/patch-lib_SelectionAttribute.php         | 11 ++++++
 .../files/patch-lib_ShadowAttribute.php            | 11 ++++++
 net/phpldapadmin/files/patch-lib_Tree.php          | 11 ++++++
 net/phpldapadmin/files/patch-lib_Visitor.php       | 43 ++++++++++++++++++++++
 net/phpldapadmin/files/patch-lib_common.php        | 13 +++++++
 net/phpldapadmin/files/patch-lib_ds__ldap.php      | 38 +++++++++++++++++++
 net/phpldapadmin/files/patch-lib_ds__ldap__pla.php | 29 +++++++++++++++
 net/phpldapadmin/files/patch-lib_functions.php     | 31 ++++++++++++++++
 net/phpldapadmin/files/patch-lib_xmlTemplates.php  | 11 ++++++
 ...tools__po__Makefile => patch-tools_po_Makefile} |  2 +-
 25 files changed, 374 insertions(+), 3 deletions(-)

diff --git a/net/phpldapadmin/Makefile b/net/phpldapadmin/Makefile
index 95c223f43a7d..b58479861751 100644
--- a/net/phpldapadmin/Makefile
+++ b/net/phpldapadmin/Makefile
@@ -2,6 +2,7 @@
 
 PORTNAME=	phpldapadmin
 PORTVERSION=	1.2.6.3
+PORTREVISION=	1
 CATEGORIES=	net www
 PKGNAMESUFFIX=	${PHP_PKGNAMESUFFIX}
 
@@ -44,14 +45,17 @@ SUB_FILES+=	pkg-message
 
 post-patch:
 	cd ${WRKSRC} ;							    \
+	cp lib/Attribute.php lib/PLAAttribute.php;			    \
 	${FIND} . ! -type d ! -name ${CFGFILE}.example ! -name .cvsignore   \
-	    ! -name .gitignore ! -name *.orig | ${SORT} |		    \
+	    ! -name .gitignore ! -name *.orig 				    \
+	    ! -name Attribute.php | ${SORT} |				    \
 	    ${SED} -e "s!^\.!${WWWDIR_REL}!"			>${PLIST} ;
 
 do-install:
 	cd ${WRKSRC} ;					 \
 	for src in $$( ${FIND} . ! -name .cvsignore	 \
-		! -name .gitignore ! -name *.orig ) ; do \
+		! -name .gitignore ! -name *.orig	 \
+		! -name Attribute.php) ; do		 \
 	    dst=${STAGEDIR}${WWWDIR}$${src#.} ;		 \
 	    if ${TEST} -d $$src ; then			 \
 		${MKDIR} $$dst ;			 \
diff --git a/net/phpldapadmin/files/patch-htdocs_collapse.php b/net/phpldapadmin/files/patch-htdocs_collapse.php
new file mode 100644
index 000000000000..19d45a350dae
--- /dev/null
+++ b/net/phpldapadmin/files/patch-htdocs_collapse.php
@@ -0,0 +1,11 @@
+--- htdocs/collapse.php.orig	2021-12-12 02:35:51 UTC
++++ htdocs/collapse.php
+@@ -19,7 +19,7 @@ $dn = get_request('dn','GET',true);
+ $tree = get_cached_item($app['server']->getIndex(),'tree');
+ $entry = $tree->getEntry($dn);
+ $entry->close();
+-set_cached_item($app['server']->getIndex(),'tree','null',$tree);
++set_cached_item($app['server']->getIndex(),$tree,'tree','null');
+ 
+ header(sprintf('Location:index.php?server_id=%s&junk=%s#%s%s',
+ 	$app['server']->getIndex(),random_junk(),htmlid($app['server']->getIndex(),$dn),app_session_param()));
diff --git a/net/phpldapadmin/files/patch-htdocs_draw__tree__node.php b/net/phpldapadmin/files/patch-htdocs_draw__tree__node.php
new file mode 100644
index 000000000000..4e27a0f9497e
--- /dev/null
+++ b/net/phpldapadmin/files/patch-htdocs_draw__tree__node.php
@@ -0,0 +1,11 @@
+--- htdocs/draw_tree_node.php.orig	2021-12-12 02:35:51 UTC
++++ htdocs/draw_tree_node.php
+@@ -50,7 +50,7 @@ if ($request['dn']) {
+ }
+ 
+ if ($treesave)
+-	set_cached_item($app['server']->getIndex(),'tree','null',$tree);
++	set_cached_item($app['server']->getIndex(),$tree,'tree','null');
+ 
+ if ($request['dn'])
+ 	echo $tree->draw_children($dnentry,$request['code']);
diff --git a/net/phpldapadmin/files/patch-htdocs_expand.php b/net/phpldapadmin/files/patch-htdocs_expand.php
new file mode 100644
index 000000000000..62962d0bce47
--- /dev/null
+++ b/net/phpldapadmin/files/patch-htdocs_expand.php
@@ -0,0 +1,11 @@
+--- htdocs/expand.php.orig	2021-12-12 02:35:51 UTC
++++ htdocs/expand.php
+@@ -19,7 +19,7 @@ $dn = get_request('dn','GET',true);
+ $tree = get_cached_item($app['server']->getIndex(),'tree');
+ $entry = $tree->getEntry($dn);
+ $entry->open();
+-set_cached_item($app['server']->getIndex(),'tree','null',$tree);
++set_cached_item($app['server']->getIndex(),$tree,'tree','null');
+ 
+ header(sprintf('Location:index.php?server_id=%s&junk=%s#%s%s',
+ 	$app['server']->getIndex(),random_junk(),htmlid($app['server']->getIndex(),$dn),app_session_param()));
diff --git a/net/phpldapadmin/files/patch-htdocs_refresh.php b/net/phpldapadmin/files/patch-htdocs_refresh.php
new file mode 100644
index 000000000000..3779e73e942b
--- /dev/null
+++ b/net/phpldapadmin/files/patch-htdocs_refresh.php
@@ -0,0 +1,11 @@
+--- htdocs/refresh.php.orig	2021-12-12 02:35:51 UTC
++++ htdocs/refresh.php
+@@ -34,7 +34,7 @@ if (get_request('purge','REQUEST')) {
+ 		$entry->open();
+ 	}
+ 
+-	set_cached_item($app['server']->getIndex(),'tree','null',$tree);
++	set_cached_item($app['server']->getIndex(),$tree,'tree','null');
+ }
+ 
+ if (get_request('meth','REQUEST') == 'ajax') 
diff --git a/net/phpldapadmin/files/patch-lib_Attribute.php b/net/phpldapadmin/files/patch-lib_Attribute.php
new file mode 100644
index 000000000000..52a760568e4b
--- /dev/null
+++ b/net/phpldapadmin/files/patch-lib_Attribute.php
@@ -0,0 +1,11 @@
+--- lib/Attribute.php.orig	2021-12-12 02:35:51 UTC
++++ lib/Attribute.php
+@@ -12,7 +12,7 @@
+  * @package phpLDAPadmin
+  * @subpackage Templates
+  */
+-class Attribute {
++class PLAAttribute {
+ 	# Attribute Name
+ 	public $name;
+ 	# Source of this attribute definition
diff --git a/net/phpldapadmin/files/patch-lib_AttributeFactory.php b/net/phpldapadmin/files/patch-lib_AttributeFactory.php
new file mode 100644
index 000000000000..7bbd14ea5b12
--- /dev/null
+++ b/net/phpldapadmin/files/patch-lib_AttributeFactory.php
@@ -0,0 +1,11 @@
+--- lib/AttributeFactory.php.orig	2021-12-12 02:35:51 UTC
++++ lib/AttributeFactory.php
+@@ -133,7 +133,7 @@ class AttributeFactory {
+ 			return $this->newGidAttribute($name,$values,$server_id,$source);
+ 
+ 		} else {
+-			return new Attribute($name,$values,$server_id,$source);
++			return new PLAAttribute($name,$values,$server_id,$source);
+ 		}
+ 	}
+ 
diff --git a/net/phpldapadmin/files/patch-lib_BinaryAttribute.php b/net/phpldapadmin/files/patch-lib_BinaryAttribute.php
new file mode 100644
index 000000000000..841994753df5
--- /dev/null
+++ b/net/phpldapadmin/files/patch-lib_BinaryAttribute.php
@@ -0,0 +1,11 @@
+--- lib/BinaryAttribute.php.orig	2021-12-12 02:35:51 UTC
++++ lib/BinaryAttribute.php
+@@ -12,7 +12,7 @@
+  * @package phpLDAPadmin
+  * @subpackage Templates
+  */
+-class BinaryAttribute extends Attribute {
++class BinaryAttribute extends PLAAttribute {
+ 	protected $filepaths;
+ 	protected $filenames;
+ 
diff --git a/net/phpldapadmin/files/patch-lib_DateAttribute.php b/net/phpldapadmin/files/patch-lib_DateAttribute.php
new file mode 100644
index 000000000000..4b699a6e1474
--- /dev/null
+++ b/net/phpldapadmin/files/patch-lib_DateAttribute.php
@@ -0,0 +1,10 @@
+--- lib/DateAttribute.php.orig	2021-12-12 02:35:51 UTC
++++ lib/DateAttribute.php
+@@ -12,6 +12,6 @@
+  * @package phpLDAPadmin
+  * @subpackage Templates
+  */
+-class DateAttribute extends Attribute {
++class DateAttribute extends PLAAttribute {
+ }
+ ?>
diff --git a/net/phpldapadmin/files/patch-lib_DnAttribute.php b/net/phpldapadmin/files/patch-lib_DnAttribute.php
new file mode 100644
index 000000000000..313ba2e56e6e
--- /dev/null
+++ b/net/phpldapadmin/files/patch-lib_DnAttribute.php
@@ -0,0 +1,10 @@
+--- lib/DnAttribute.php.orig	2021-12-12 02:35:51 UTC
++++ lib/DnAttribute.php
+@@ -12,6 +12,6 @@
+  * @package phpLDAPadmin
+  * @subpackage Templates
+  */
+-class DnAttribute extends Attribute {
++class DnAttribute extends PLAAttribute {
+ }
+ ?>
diff --git a/net/phpldapadmin/files/patch-lib_GidAttribute.php b/net/phpldapadmin/files/patch-lib_GidAttribute.php
new file mode 100644
index 000000000000..0f13a12edca6
--- /dev/null
+++ b/net/phpldapadmin/files/patch-lib_GidAttribute.php
@@ -0,0 +1,10 @@
+--- lib/GidAttribute.php.orig	2021-12-12 02:35:51 UTC
++++ lib/GidAttribute.php
+@@ -12,6 +12,6 @@
+  * @package phpLDAPadmin
+  * @subpackage Templates
+  */
+-class GidAttribute extends Attribute {
++class GidAttribute extends PLAAttribute {
+ }
+ ?>
diff --git a/net/phpldapadmin/files/patch-lib_MultiLineAttribute.php b/net/phpldapadmin/files/patch-lib_MultiLineAttribute.php
new file mode 100644
index 000000000000..2005a47c1168
--- /dev/null
+++ b/net/phpldapadmin/files/patch-lib_MultiLineAttribute.php
@@ -0,0 +1,11 @@
+--- lib/MultiLineAttribute.php.orig	2021-12-12 02:35:51 UTC
++++ lib/MultiLineAttribute.php
+@@ -12,7 +12,7 @@
+  * @package phpLDAPadmin
+  * @subpackage Templates
+  */
+-class MultiLineAttribute extends Attribute {
++class MultiLineAttribute extends PLAAttribute {
+ 	protected $rows = 0;
+ 	protected $cols = 0;
+ 
diff --git a/net/phpldapadmin/files/patch-lib_ObjectClassAttribute.php b/net/phpldapadmin/files/patch-lib_ObjectClassAttribute.php
new file mode 100644
index 000000000000..0d85afd7e094
--- /dev/null
+++ b/net/phpldapadmin/files/patch-lib_ObjectClassAttribute.php
@@ -0,0 +1,10 @@
+--- lib/ObjectClassAttribute.php.orig	2021-12-12 02:35:51 UTC
++++ lib/ObjectClassAttribute.php
+@@ -12,6 +12,6 @@
+  * @package phpLDAPadmin
+  * @subpackage Templates
+  */
+-class ObjectClassAttribute extends Attribute {
++class ObjectClassAttribute extends PLAAttribute {
+ }
+ ?>
diff --git a/net/phpldapadmin/files/patch-lib_PageRender.php b/net/phpldapadmin/files/patch-lib_PageRender.php
new file mode 100644
index 000000000000..95429c3281ec
--- /dev/null
+++ b/net/phpldapadmin/files/patch-lib_PageRender.php
@@ -0,0 +1,31 @@
+--- lib/PageRender.php.orig	2021-12-12 02:35:51 UTC
++++ lib/PageRender.php
+@@ -827,7 +827,7 @@ class PageRender extends Visitor {
+ 		if (! $attribute->getOldValue($i))
+ 			return;
+ 
+-		draw_jpeg_photo($this->getServer(),$this->template->getDN(),$attribute->getName(),$i,false,false);
++		draw_jpeg_photo($this->getServer(),$this->template->getDN(),$i,$attribute->getName(),false,false);
+ 	}
+ 
+ 	/**
+@@ -844,16 +844,16 @@ class PageRender extends Visitor {
+ 		# If the attribute is modified, the new value needs to be stored in a session variable for the draw_jpeg_photo callback.
+ 		if ($attribute->hasBeenModified()) {
+ 			$_SESSION['tmp'][$attribute->getName()][$i] = $attribute->getValue($i);
+-			draw_jpeg_photo(null,$this->template->getDN(),$attribute->getName(),$i,false,false);
++			draw_jpeg_photo(null,$this->template->getDN(),$i,$attribute->getName(),false,false);
+ 		} else
+-			draw_jpeg_photo($this->getServer(),$this->template->getDN(),$attribute->getName(),$i,false,false);
++			draw_jpeg_photo($this->getServer(),$this->template->getDN(),$i,$attribute->getName(),false,false);
+ 	}
+ 
+ 	protected function drawFormReadOnlyValueJpegAttribute($attribute,$i) {
+ 		$this->draw('HiddenValue',$attribute,$i);
+ 		$_SESSION['tmp'][$attribute->getName()][$i] = $attribute->getValue($i);
+ 
+-		draw_jpeg_photo(null,$this->template->getDN(),$attribute->getName(),$i,false,false);
++		draw_jpeg_photo(null,$this->template->getDN(),$i,$attribute->getName(),false,false);
+ 	}
+ 
+ 	protected function drawFormReadOnlyValueMultiLineAttribute($attribute,$i) {
diff --git a/net/phpldapadmin/files/patch-lib_PasswordAttribute.php b/net/phpldapadmin/files/patch-lib_PasswordAttribute.php
new file mode 100644
index 000000000000..ccfc3ec419c6
--- /dev/null
+++ b/net/phpldapadmin/files/patch-lib_PasswordAttribute.php
@@ -0,0 +1,10 @@
+--- lib/PasswordAttribute.php.orig	2021-12-12 02:35:51 UTC
++++ lib/PasswordAttribute.php
+@@ -12,6 +12,6 @@
+  * @package phpLDAPadmin
+  * @subpackage Templates
+  */
+-class PasswordAttribute extends Attribute {
++class PasswordAttribute extends PLAAttribute {
+ }
+ ?>
diff --git a/net/phpldapadmin/files/patch-lib_SelectionAttribute.php b/net/phpldapadmin/files/patch-lib_SelectionAttribute.php
new file mode 100644
index 000000000000..928c07a9fdca
--- /dev/null
+++ b/net/phpldapadmin/files/patch-lib_SelectionAttribute.php
@@ -0,0 +1,11 @@
+--- lib/SelectionAttribute.php.orig	2021-12-12 02:35:51 UTC
++++ lib/SelectionAttribute.php
+@@ -12,7 +12,7 @@
+  * @package phpLDAPadmin
+  * @subpackage Templates
+  */
+-class SelectionAttribute extends Attribute {
++class SelectionAttribute extends PLAAttribute {
+ 	protected $selection = array();
+ 	protected $multiple;
+ 	protected $default;
diff --git a/net/phpldapadmin/files/patch-lib_ShadowAttribute.php b/net/phpldapadmin/files/patch-lib_ShadowAttribute.php
new file mode 100644
index 000000000000..dfa105b1c680
--- /dev/null
+++ b/net/phpldapadmin/files/patch-lib_ShadowAttribute.php
@@ -0,0 +1,11 @@
+--- lib/ShadowAttribute.php.orig	2021-12-12 02:35:51 UTC
++++ lib/ShadowAttribute.php
+@@ -12,7 +12,7 @@
+  * @package phpLDAPadmin
+  * @subpackage Templates
+  */
+-class ShadowAttribute extends Attribute {
++class ShadowAttribute extends PLAAttribute {
+ 	public $shadow_before_today_attrs = array('shadowLastChange','shadowMin');
+ 	public $shadow_after_today_attrs = array('shadowMax','shadowExpire','shadowWarning','shadowInactive');
+ }
diff --git a/net/phpldapadmin/files/patch-lib_Tree.php b/net/phpldapadmin/files/patch-lib_Tree.php
new file mode 100644
index 000000000000..928ca489d5cc
--- /dev/null
+++ b/net/phpldapadmin/files/patch-lib_Tree.php
@@ -0,0 +1,11 @@
+--- lib/Tree.php.orig	2021-12-12 02:35:51 UTC
++++ lib/Tree.php
+@@ -68,7 +68,7 @@ abstract class Tree {
+ 				}
+ 			}
+ 
+-			set_cached_item($server_id,'tree','null',$tree);
++			set_cached_item($server_id,$tree,'tree','null');
+ 		}
+ 
+ 		return $tree;
diff --git a/net/phpldapadmin/files/patch-lib_Visitor.php b/net/phpldapadmin/files/patch-lib_Visitor.php
new file mode 100644
index 000000000000..2ba2a552d833
--- /dev/null
+++ b/net/phpldapadmin/files/patch-lib_Visitor.php
@@ -0,0 +1,43 @@
+--- lib/Visitor.php.orig	2021-12-12 02:35:51 UTC
++++ lib/Visitor.php
+@@ -22,6 +22,15 @@ abstract class Visitor {
+ 	protected $server_id;
+ 
+ 	public function __call($method,$args) {
++		# This mapping array allows to map effective class names to
++		# function name suffixes.
++		# It has been introduced when class Attribute has been renamed
++		# to PLAAttribute to avoid a name clash with the built-in
++		# class of PHP 8.
++		# Entering a class name mapping here allows to rename the
++		# class without having to rename the methods too.
++		static $classmap = array('PLAAttribute' => 'Attribute');
++
+ 		if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
+ 			debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
+ 
+@@ -33,19 +42,14 @@ abstract class Visitor {
+ 		$fnct = array_shift($args);
+ 
+ 		$object = $args[0];
+-		$class = get_class($object);
+ 
+-		$call = "$method$fnct$class";
+-
+-		array_push($methods,$call);
+-
+-		while ($class && ! method_exists($this,$call)) {
++		for ($class = get_class($object); $class; $class = get_parent_class($class)) {
++			$call = isset($classmap[$class])? "$method$fnct$classmap[$class]": "$method$fnct$class";
++			array_push($methods,$call);
++			if (method_exists($this,$call))
++				break;
+ 			if (defined('DEBUGTMP') && DEBUGTMP)
+ 				printf('<font size=-2><i>Class (%s): Method doesnt exist (%s,%s)</i></font><br />',$class,get_class($this),$call);
+-
+-			$class = get_parent_class($class);
+-			$call = "$method$fnct$class";
+-			array_push($methods,$call);
+ 		}
+ 
+ 		if (defined('DEBUGTMP') && DEBUGTMP)
diff --git a/net/phpldapadmin/files/patch-lib_common.php b/net/phpldapadmin/files/patch-lib_common.php
new file mode 100644
index 000000000000..3fd26f51085a
--- /dev/null
+++ b/net/phpldapadmin/files/patch-lib_common.php
@@ -0,0 +1,13 @@
+--- lib/common.php.orig	2021-12-12 02:35:51 UTC
++++ lib/common.php
+@@ -296,7 +296,9 @@ if ($app['language'] == 'auto') {
+  * Strip slashes from GET, POST, and COOKIE variables if this
+  * PHP install is configured to automatically addslashes()
+  */
+-if (@get_magic_quotes_gpc() && (! isset($slashes_stripped) || ! $slashes_stripped)) {
++if (@version_compare(phpversion(), '5.4.0', '<') &&
++    @get_magic_quotes_gpc() &&
++    (!isset($slashes_stripped) || !$slashes_stripped)) {
+ 	array_stripslashes($_REQUEST);
+ 	array_stripslashes($_GET);
+ 	array_stripslashes($_POST);
diff --git a/net/phpldapadmin/files/patch-lib_ds__ldap.php b/net/phpldapadmin/files/patch-lib_ds__ldap.php
new file mode 100644
index 000000000000..4e341a6eb75f
--- /dev/null
+++ b/net/phpldapadmin/files/patch-lib_ds__ldap.php
@@ -0,0 +1,38 @@
+--- lib/ds_ldap.php.orig	2021-12-12 02:35:51 UTC
++++ lib/ds_ldap.php
+@@ -1768,7 +1768,7 @@ class ldap extends DS {
+ 			ksort($return);
+ 
+ 			# cache the schema to prevent multiple schema fetches from LDAP server
+-			set_cached_item($this->index,'schema','objectclasses',$return);
++			set_cached_item($this->index,$return,'schema','objectclasses');
+ 		}
+ 
+ 		if (DEBUG_ENABLED)
+@@ -1953,7 +1953,7 @@ class ldap extends DS {
+ 			$return = $attrs;
+ 
+ 			# cache the schema to prevent multiple schema fetches from LDAP server
+-			set_cached_item($this->index,'schema','attributes',$return);
++			set_cached_item($this->index,$return,'schema','attributes');
+ 		}
+ 
+ 		if (DEBUG_ENABLED)
+@@ -2029,7 +2029,7 @@ class ldap extends DS {
+ 			$return = $rules;
+ 
+ 			# cache the schema to prevent multiple schema fetches from LDAP server
+-			set_cached_item($this->index,'schema','matchingrules',$return);
++			set_cached_item($this->index,$return,'schema','matchingrules');
+ 		}
+ 
+ 		if (DEBUG_ENABLED)
+@@ -2078,7 +2078,7 @@ class ldap extends DS {
+ 			ksort($return);
+ 
+ 			# cache the schema to prevent multiple schema fetches from LDAP server
+-			set_cached_item($this->index,'schema','syntaxes',$return);
++			set_cached_item($this->index,$return,'schema','syntaxes');
+ 		}
+ 
+ 		if (DEBUG_ENABLED)
diff --git a/net/phpldapadmin/files/patch-lib_ds__ldap__pla.php b/net/phpldapadmin/files/patch-lib_ds__ldap__pla.php
new file mode 100644
index 000000000000..01252ca6e6de
--- /dev/null
+++ b/net/phpldapadmin/files/patch-lib_ds__ldap__pla.php
@@ -0,0 +1,29 @@
+--- lib/ds_ldap_pla.php.orig	2021-12-12 02:35:51 UTC
++++ lib/ds_ldap_pla.php
+@@ -371,7 +371,7 @@ class ldap_pla extends ldap {
+ 
+ 				$tree->addEntry($dn);
+ 
+-				set_cached_item($this->index,'tree','null',$tree);
++				set_cached_item($this->index,$tree,'tree','null');
+ 
+ 				run_hook('post_entry_create',array('server_id'=>$this->index,'method'=>$method,'dn'=>$dn,'attrs'=>$entry_array));
+ 
+@@ -403,7 +403,7 @@ class ldap_pla extends ldap {
+ 				$tree = get_cached_item($this->index,'tree');
+ 				$tree->delEntry($dn);
+ 
+-				set_cached_item($this->index,'tree','null',$tree);
++				set_cached_item($this->index,$tree,'tree','null');
+ 
+ 				run_hook('post_entry_delete',array('server_id'=>$this->index,'method'=>$method,'dn'=>$dn));
+ 			}
+@@ -430,7 +430,7 @@ class ldap_pla extends ldap {
+ 				$newdn = sprintf('%s,%s',$new_rdn,$container);
+ 				$tree->renameEntry($dn,$newdn);
+ 
+-				set_cached_item($this->index,'tree','null',$tree);
++				set_cached_item($this->index,$tree,'tree','null');
+ 
+ 				run_hook('post_entry_rename',array('server_id'=>$this->index,'method'=>$method,'dn'=>$dn,'rdn'=>$new_rdn,'container'=>$container));
+ 			}
diff --git a/net/phpldapadmin/files/patch-lib_functions.php b/net/phpldapadmin/files/patch-lib_functions.php
new file mode 100644
index 000000000000..23b2a5a43682
--- /dev/null
+++ b/net/phpldapadmin/files/patch-lib_functions.php
@@ -0,0 +1,31 @@
+--- lib/functions.php.orig	2021-12-12 02:35:51 UTC
++++ lib/functions.php
+@@ -928,7 +928,7 @@ function get_cached_item($index,$item,$subitem='null')
+  *
+  * Returns true on success of false on failure.
+  */
+-function set_cached_item($index,$item,$subitem='null',$data) {
++function set_cached_item($index,$data,$item,$subitem='null') {
+ 	if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
+ 		debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
+ 
+@@ -2032,8 +2032,8 @@ function ldap_error_msg($msg,$errnum) {
+  *
+  * Usage Examples:
+  *  <code>
+- *   draw_jpeg_photo(0,'cn=Bob,ou=People,dc=example,dc=com',"jpegPhoto",0,true,array('img_opts'=>"border: 1px; width: 150px"));
+- *   draw_jpeg_photo(1,'cn=Fred,ou=People,dc=example,dc=com',null,1);
++ *   draw_jpeg_photo(0,'cn=Bob,ou=People,dc=example,dc=com',0,"jpegPhoto",true,array('img_opts'=>"border: 1px; width: 150px"));
++ *   draw_jpeg_photo(1,'cn=Fred,ou=People,dc=example,dc=com',1,null);
+  *  </code>
+  *
+  * @param object The Server to get the image from.
+@@ -2046,7 +2046,7 @@ function ldap_error_msg($msg,$errnum) {
+  * @param array Specifies optional image and CSS style attributes for the table tag. Supported keys are
+  *                fixed_width, fixed_height, img_opts.
+  */
+-function draw_jpeg_photo($server,$dn,$attr_name='jpegphoto',$index,$draw_delete_buttons=false,$options=array()) {
++function draw_jpeg_photo($server,$dn,$index,$attr_name='jpegphoto',$draw_delete_buttons=false,$options=array()) {
+ 	if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
+ 		debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
+ 
diff --git a/net/phpldapadmin/files/patch-lib_xmlTemplates.php b/net/phpldapadmin/files/patch-lib_xmlTemplates.php
new file mode 100644
index 000000000000..1fb0f3632fb7
--- /dev/null
+++ b/net/phpldapadmin/files/patch-lib_xmlTemplates.php
@@ -0,0 +1,11 @@
+--- lib/xmlTemplates.php.orig	2021-12-12 02:35:51 UTC
++++ lib/xmlTemplates.php
+@@ -140,7 +140,7 @@ abstract class xmlTemplates {
+ 
+ 		if ($changed) {
+ 			masort($this->templates,'title');
+-			set_cached_item($server_id,$class['item'],'null',$this->templates);
++			set_cached_item($server_id,$this->templates,$class['item'],'null');
+ 		}
+ 	}
+ 
diff --git a/net/phpldapadmin/files/patch-tools__po__Makefile b/net/phpldapadmin/files/patch-tools_po_Makefile
similarity index 76%
rename from net/phpldapadmin/files/patch-tools__po__Makefile
rename to net/phpldapadmin/files/patch-tools_po_Makefile
index efdf4d97aa13..24f373f67510 100644
--- a/net/phpldapadmin/files/patch-tools__po__Makefile
+++ b/net/phpldapadmin/files/patch-tools_po_Makefile
@@ -1,4 +1,4 @@
---- tools/po/Makefile.orig	2012-10-01 06:54:14 UTC
+--- tools/po/Makefile.orig	2021-12-12 02:35:51 UTC
 +++ tools/po/Makefile
 @@ -1,4 +1,3 @@
 -#!/bin/bash