git: fee2b338d2af - main - net/phpldapadmin: fix support for php81+

From: Ronald Klop <ronald_at_FreeBSD.org>
Date: Thu, 01 Dec 2022 09:54:49 UTC
The branch main has been updated by ronald:

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

commit fee2b338d2af883ca4dd75a7d285f65b284fb73b
Author:     Krzysztof <ports@bsdserwis.com>
AuthorDate: 2022-11-27 20:17:33 +0000
Commit:     Ronald Klop <ronald@FreeBSD.org>
CommitDate: 2022-12-01 09:53:34 +0000

    net/phpldapadmin: fix support for php81+
    
    PR:     266678
    Reported by:    Gerard Seibert
    Approved by: rene (mentor)
    Differential Revision: https://reviews.freebsd.org/D37513
---
 net/phpldapadmin/Makefile                          |   2 +-
 .../files/patch-htdocs_add__oclass__form.php       |  11 +
 .../files/patch-htdocs_add__value__form.php        |  32 ++
 net/phpldapadmin/files/patch-htdocs_cmd.php        |  11 +
 net/phpldapadmin/files/patch-htdocs_copy.php       |  11 +
 .../files/patch-htdocs_download__binary__attr.php  |  11 +
 .../files/patch-htdocs_export__form.php            |  11 +
 net/phpldapadmin/files/patch-htdocs_login.php      |  11 +
 .../files/patch-htdocs_login__form.php             |  16 +
 net/phpldapadmin/files/patch-htdocs_monitor.php    |  29 ++
 .../files/patch-htdocs_purge__cache.php            |  11 +
 net/phpldapadmin/files/patch-htdocs_schema.php     | 165 ++++++++
 .../files/patch-htdocs_server__info.php            |  20 +
 .../files/patch-htdocs_view__jpeg__photo.php       |  11 +
 net/phpldapadmin/files/patch-lib_AJAXTree.php      |  47 +++
 net/phpldapadmin/files/patch-lib_Attribute.php     |  66 ++-
 .../files/patch-lib_AttributeFactory.php           |  51 ++-
 net/phpldapadmin/files/patch-lib_HTMLTree.php      |  32 ++
 net/phpldapadmin/files/patch-lib_PageRender.php    | 135 +++++-
 net/phpldapadmin/files/patch-lib_Query.php         |  68 +++
 net/phpldapadmin/files/patch-lib_QueryRender.php   |  38 ++
 net/phpldapadmin/files/patch-lib_Template.php      | 248 +++++++++++
 .../files/patch-lib_TemplateRender.php             |  99 +++++
 net/phpldapadmin/files/patch-lib_Tree.php          |  23 +-
 net/phpldapadmin/files/patch-lib_TreeItem.php      |  11 +
 net/phpldapadmin/files/patch-lib_common.php        |  23 +-
 net/phpldapadmin/files/patch-lib_ds.php            |  29 ++
 net/phpldapadmin/files/patch-lib_ds__ldap.php      | 465 +++++++++++++++++++-
 net/phpldapadmin/files/patch-lib_ds__ldap__pla.php |  65 +--
 .../files/patch-lib_export__functions.php          |  46 ++
 net/phpldapadmin/files/patch-lib_functions.php     | 469 ++++++++++++++++++++-
 .../files/patch-lib_import__functions.php          | 104 +++++
 net/phpldapadmin/files/patch-lib_page.php          |  29 ++
 .../files/patch-lib_schema__functions.php          | 365 ++++++++++++++++
 net/phpldapadmin/files/patch-lib_xml2array.php     |  20 +
 net/phpldapadmin/files/patch-lib_xmlTemplates.php  |  48 ++-
 36 files changed, 2698 insertions(+), 135 deletions(-)

diff --git a/net/phpldapadmin/Makefile b/net/phpldapadmin/Makefile
index ebee716813cf..62831744b9d2 100644
--- a/net/phpldapadmin/Makefile
+++ b/net/phpldapadmin/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	phpldapadmin
 PORTVERSION=	1.2.6.3
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	net www
 PKGNAMESUFFIX=	${PHP_PKGNAMESUFFIX}
 
diff --git a/net/phpldapadmin/files/patch-htdocs_add__oclass__form.php b/net/phpldapadmin/files/patch-htdocs_add__oclass__form.php
new file mode 100644
index 000000000000..18a1b8d5eb02
--- /dev/null
+++ b/net/phpldapadmin/files/patch-htdocs_add__oclass__form.php
@@ -0,0 +1,11 @@
+--- htdocs/add_oclass_form.php.orig	2021-12-12 02:35:51 UTC
++++ htdocs/add_oclass_form.php
+@@ -36,7 +36,7 @@ $ldap['attrs']['must'] = array();
+ 
+ foreach ($request['template']->getAttribute('objectclass')->getValues() as $oclass_name) {
+ 	# Exclude "top" if its there.
+-	if (! strcasecmp('top',$oclass_name))
++	if (! strcasecmp('top',(string) $oclass_name))
+ 		continue;
+ 
+ 	if ($soc = $app['server']->getSchemaObjectClass($oclass_name))
diff --git a/net/phpldapadmin/files/patch-htdocs_add__value__form.php b/net/phpldapadmin/files/patch-htdocs_add__value__form.php
new file mode 100644
index 000000000000..f7546f5c7c55
--- /dev/null
+++ b/net/phpldapadmin/files/patch-htdocs_add__value__form.php
@@ -0,0 +1,32 @@
+--- htdocs/add_value_form.php.orig	2021-12-12 02:35:51 UTC
++++ htdocs/add_value_form.php
+@@ -32,12 +32,12 @@ if ($request['attribute']->isReadOnly())
+ */
+ 
+ # Render the form
+-if (! strcasecmp($request['attr'],'objectclass') || get_request('meth','REQUEST') != 'ajax') {
++if (! strcasecmp((string) $request['attr'],'objectclass') || get_request('meth','REQUEST') != 'ajax') {
+ 	# Render the form.
+ 	$request['page']->drawTitle(sprintf('%s <b>%s</b> %s <b>%s</b>',_('Add new'),htmlspecialchars($request['attr']),_('value to'),htmlspecialchars(get_rdn($request['dn']))));
+ 	$request['page']->drawSubTitle();
+ 
+-	if (! strcasecmp($request['attr'],'objectclass')) {
++	if (! strcasecmp((string) $request['attr'],'objectclass')) {
+ 		echo '<form action="cmd.php" method="post" class="new_value" id="entry_form">';
+ 		echo '<div>';
+ 		echo '<input type="hidden" name="cmd" value="add_oclass_form" />';
+@@ -91,12 +91,12 @@ if (! strcasecmp($request['attr'],'objectclass') || ge
+ 	printf('<td class="top">%s</td>',_('Enter the value(s) you would like to add:'));
+ 	echo '<td>';
+ 
+-	if (! strcasecmp($request['attr'],'objectclass')) {
++	if (! strcasecmp((string) $request['attr'],'objectclass')) {
+ 		# If our attr is an objectClass, fetch all available objectClasses and remove those from the list that are already defined in the entry
+ 		$socs = $app['server']->SchemaObjectClasses();
+ 
+ 		foreach ($request['attribute']->getValues() as $oclass)
+-			unset($socs[strtolower($oclass)]);
++			unset($socs[strtolower((string) $oclass)]);
+ 
+ 		# Draw objectClass selection
+ 		echo '<table border="0">';
diff --git a/net/phpldapadmin/files/patch-htdocs_cmd.php b/net/phpldapadmin/files/patch-htdocs_cmd.php
new file mode 100644
index 000000000000..1f4d7b8bf8f0
--- /dev/null
+++ b/net/phpldapadmin/files/patch-htdocs_cmd.php
@@ -0,0 +1,11 @@
+--- htdocs/cmd.php.orig	2021-12-12 02:35:51 UTC
++++ htdocs/cmd.php
+@@ -41,7 +41,7 @@ if (DEBUG_ENABLED)
+ $www['page'] = new page($app['server']->getIndex());
+ 
+ # See if we can render the command
+-if (trim($www['cmd'])) {
++if (trim((string) $www['cmd'])) {
+ 	# If this is a READ-WRITE operation, the LDAP server must not be in READ-ONLY mode.
+ 	if ($app['server']->isReadOnly() && ! in_array(get_request('cmd','REQUEST'),$app['readwrite_cmds']))
+ 		error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
diff --git a/net/phpldapadmin/files/patch-htdocs_copy.php b/net/phpldapadmin/files/patch-htdocs_copy.php
new file mode 100644
index 000000000000..3f0a46fcfea2
--- /dev/null
+++ b/net/phpldapadmin/files/patch-htdocs_copy.php
@@ -0,0 +1,11 @@
+--- htdocs/copy.php.orig	2021-12-12 02:35:51 UTC
++++ htdocs/copy.php
+@@ -21,7 +21,7 @@ $ldap['SRC'] = $_SESSION[APPCONFIG]->getServer(get_req
+ $ldap['DST'] = $_SESSION[APPCONFIG]->getServer(get_request('server_id_dst'));
+ 
+ # Error checking
+-if (! trim($request['dnDST']))
++if (! trim((string) $request['dnDST']))
+ 	error(_('You left the destination DN blank.'),'error','index.php');
+ 
+ if ($ldap['DST']->isReadOnly())
diff --git a/net/phpldapadmin/files/patch-htdocs_download__binary__attr.php b/net/phpldapadmin/files/patch-htdocs_download__binary__attr.php
new file mode 100644
index 000000000000..e855abaaaf7f
--- /dev/null
+++ b/net/phpldapadmin/files/patch-htdocs_download__binary__attr.php
@@ -0,0 +1,11 @@
+--- htdocs/download_binary_attr.php.orig	2021-12-12 02:35:51 UTC
++++ htdocs/download_binary_attr.php
+@@ -15,7 +15,7 @@ require './common.php';
+ 
+ $request = array();
+ $request['dn'] = get_request('dn','GET');
+-$request['attr'] = strtolower(get_request('attr','GET',true));
++$request['attr'] = strtolower((string) get_request('attr','GET',true));
+ $request['index'] = get_request('index','GET',false,0);
+ $request['type'] = get_request('type','GET',false,'octet-stream');
+ $request['filename'] = get_request('filename','GET',false,sprintf('%s:%s.bin',get_rdn($request['dn'],true),$request['attr']));
diff --git a/net/phpldapadmin/files/patch-htdocs_export__form.php b/net/phpldapadmin/files/patch-htdocs_export__form.php
new file mode 100644
index 000000000000..57387665fe49
--- /dev/null
+++ b/net/phpldapadmin/files/patch-htdocs_export__form.php
@@ -0,0 +1,11 @@
+--- htdocs/export_form.php.orig	2021-12-12 02:35:51 UTC
++++ htdocs/export_form.php
+@@ -166,7 +166,7 @@ function get_line_end_format() {
+  */
+ function get_user_agent_string() {
+ 	if (isset($_SERVER['HTTP_USER_AGENT']))
+-		return strtolower($_SERVER['HTTP_USER_AGENT']);
++		return strtolower((string) $_SERVER['HTTP_USER_AGENT']);
+ 	else
+ 		return '';
+ }
diff --git a/net/phpldapadmin/files/patch-htdocs_login.php b/net/phpldapadmin/files/patch-htdocs_login.php
new file mode 100644
index 000000000000..3ef6332048ac
--- /dev/null
+++ b/net/phpldapadmin/files/patch-htdocs_login.php
@@ -0,0 +1,11 @@
+--- htdocs/login.php.orig	2021-12-12 02:35:51 UTC
++++ htdocs/login.php
+@@ -22,7 +22,7 @@ if ($pass) {
+     $user['password'] = get_request('login_pass');
+     $user['password'] = html_entity_decode($user['password'], ENT_QUOTES);
+ 
+-    if ($user['login'] && !strlen($user['password'])) {
++    if ($user['login'] && empty($user['password'])) {
+         system_message(array(
+             'title' => _('Authenticate to server'),
+             'body'  => _('You left the password blank.'),
diff --git a/net/phpldapadmin/files/patch-htdocs_login__form.php b/net/phpldapadmin/files/patch-htdocs_login__form.php
new file mode 100644
index 000000000000..167c8f898f0a
--- /dev/null
+++ b/net/phpldapadmin/files/patch-htdocs_login__form.php
@@ -0,0 +1,16 @@
+--- htdocs/login_form.php.orig	2021-12-12 02:35:51 UTC
++++ htdocs/login_form.php
+@@ -19,11 +19,11 @@ echo '<br />';
+ $isHTTPS = false;
+ 
+ # Check if the current connection is encrypted
+-if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') {
++if (isset($_SERVER['HTTPS']) && strtolower((string) $_SERVER['HTTPS']) == 'on') {
+         $isHTTPS = true;
+ }
+ # Check if a proxy server downstream does encryption for us
+-elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && strtolower($_SERVER['HTTP_X_FORWARDED_SSL'])
++elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower((string) $_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && strtolower($_SERVER['HTTP_X_FORWARDED_SSL'])
+ == 'on') {
+         $isHTTPS = true;
+ }
diff --git a/net/phpldapadmin/files/patch-htdocs_monitor.php b/net/phpldapadmin/files/patch-htdocs_monitor.php
new file mode 100644
index 000000000000..50f11af4ad41
--- /dev/null
+++ b/net/phpldapadmin/files/patch-htdocs_monitor.php
@@ -0,0 +1,29 @@
+--- htdocs/monitor.php.orig	2021-12-12 02:35:51 UTC
++++ htdocs/monitor.php
+@@ -48,7 +48,7 @@ foreach (array(
+ 	if (isset($results[$dn]['description'])) {
+ 		$description = implode(' ',$results[$dn]['description']);
+ 
+-		$description = preg_replace('/"/','\'',$description);
++		$description = preg_replace('/"/','\'',is_null($description)? "":$description);
+ 	} else {
+ 		$description = '';
+ 	}
+@@ -103,7 +103,7 @@ foreach (array(
+ 				else
+ 					$sc = $results[$key][$attr];
+ 
+-				if (strcasecmp('supportedcontrol',$attr) == 0)
++				if (strcasecmp('supportedcontrol',(string) $attr) == 0)
+ 					foreach ($sc as $control) {
+ 						$oidtotext = support_oid_to_text($control);
+ 
+@@ -199,7 +199,7 @@ foreach (array(
+ 	) as $dn ) {
+ 
+ 	$description = implode(' ',$results[$dn]['description']);
+-	$description = preg_replace('/"/','\'',$description);
++	$description = preg_replace('/"/','\'',is_null($description)? "":$description);
+ 
+ 	printf('<tr class="list_item"><td class="heading" rowspan="2"><acronym title="%s">%s</acronym></td></tr>',$description,$dn);
+ 	echo '<tr class="list_item"><td class="value">';
diff --git a/net/phpldapadmin/files/patch-htdocs_purge__cache.php b/net/phpldapadmin/files/patch-htdocs_purge__cache.php
new file mode 100644
index 000000000000..c72239368b37
--- /dev/null
+++ b/net/phpldapadmin/files/patch-htdocs_purge__cache.php
@@ -0,0 +1,11 @@
+--- htdocs/purge_cache.php.orig	2021-12-12 02:35:51 UTC
++++ htdocs/purge_cache.php
+@@ -16,7 +16,7 @@ $purge_session_keys = array('app_initialized','backtra
+ $size = 0;
+ foreach ($purge_session_keys as $key)
+ 	if (isset($_SESSION[$key])) {
+-		$size += strlen(serialize($_SESSION[$key]));
++		$size += strlen((string) serialize($_SESSION[$key]));
+ 		unset($_SESSION[$key]);
+ 	}
+ 
diff --git a/net/phpldapadmin/files/patch-htdocs_schema.php b/net/phpldapadmin/files/patch-htdocs_schema.php
new file mode 100644
index 000000000000..191d2a2b1647
--- /dev/null
+++ b/net/phpldapadmin/files/patch-htdocs_schema.php
@@ -0,0 +1,165 @@
+--- htdocs/schema.php.orig	2021-12-12 02:35:51 UTC
++++ htdocs/schema.php
+@@ -25,7 +25,7 @@ $entry['value'] = get_request('viewvalue','GET');
+ 
+ if (! is_null($entry['value'])) {
+ 	$entry['viewed'] = false;
+-	$entry['value'] = strtolower($entry['value']);
++	$entry['value'] = strtolower((string) $entry['value']);
+ }
+ 
+ $schema_error_str = sprintf('%s <b>%s</b>.<br /><br /></div>%s<ul><li>%s</li><li>%s</li><li>%s</li><li>%s</li></ul>',
+@@ -149,12 +149,12 @@ switch($entry['view']) {
+ 		echo '<br />';
+ 
+ 		foreach ($sattrs as $attr) {
+-			if (isAjaxEnabled() || (is_null($entry['value']) || ! trim($entry['value']) || $entry['value']==$attr->getName())) {
+-				if ((! is_null($entry['value']) && $entry['value']==$attr->getName()) || ! trim($entry['value']))
++			if (isAjaxEnabled() || (is_null($entry['value']) || ! trim((string) $entry['value']) || $entry['value']==$attr->getName())) {
++				if ((! is_null($entry['value']) && $entry['value']==$attr->getName()) || ! trim((string) $entry['value']))
+ 					$entry['viewed'] = true;
+ 
+ 				if (isAjaxEnabled() && $entry['value'])
+-					printf('<div id="at%s" style="display: %s">',$attr->getName(),strcasecmp($entry['value'],$attr->getName()) ? 'none' : 'block');
++					printf('<div id="at%s" style="display: %s">',(string) $attr->getName(),strcasecmp((string) $entry['value'],(string) $attr->getName()) ? 'none' : 'block');
+ 				else
+ 					printf('<div id="at%s">',$attr->getName());
+ 
+@@ -193,10 +193,10 @@ switch($entry['view']) {
+ 								printf('(%s)',_('none'));
+ 
+ 							else {
+-								$href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['attributes'],strtolower($attr->getSupAttribute())));
++								$href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['attributes'],strtolower((string) $attr->getSupAttribute())));
+ 								if (isAjaxEnabled())
+ 									printf('<a href="cmd.php?%s" onclick="return ajSHOWSCHEMA(\'attributes\',\'at\',\'%s\');">%s</a>',
+-										$href,strtolower($attr->getSupAttribute()),$attr->getSupAttribute());
++										$href,strtolower((string) $attr->getSupAttribute()),$attr->getSupAttribute());
+ 								else
+ 									printf('<a href="cmd.php?%s">%s</a>',$href,$attr->getSupAttribute());
+ 							}
+@@ -287,10 +287,10 @@ switch($entry['view']) {
+ 
+ 							else
+ 								foreach ($attr->getAliases() as $alias) {
+-									$href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['attributes'],strtolower($alias)));
++									$href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['attributes'],strtolower((string) $alias)));
+ 									if (isAjaxEnabled())
+ 										printf('<a href="cmd.php?%s" onclick="return ajSHOWSCHEMA(\'attributes\',\'at\',\'%s\');">%s</a>',
+-											$href,strtolower($alias),$alias);
++											$href,strtolower((string) $alias),$alias);
+ 									else
+ 										printf('<a href="cmd.php?%s">%s</a>',$href,$alias);
+ 								}
+@@ -306,10 +306,10 @@ switch($entry['view']) {
+ 
+ 							else
+ 								foreach ($attr->getUsedInObjectClasses() as $objectclass) {
+-									$href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower($objectclass)));
++									$href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower((string) $objectclass)));
+ 									if (isAjaxEnabled())
+ 										printf('<a href="cmd.php?%s" onclick="return ajJUMP(\'%s\',\'%s\',\'%s\');">%s</a> ',
+-											$href,$href,_('ObjectClasses'),strtolower($objectclass),$objectclass);
++											$href,$href,_('ObjectClasses'),strtolower((string) $objectclass),$objectclass);
+ 									else
+ 										printf('<a href="cmd.php?%s">%s</a> ',$href,$objectclass);
+ 								}
+@@ -379,8 +379,8 @@ switch($entry['view']) {
+ 			$oid = $rule->getOID();
+ 			$desc = $rule->getName(false);
+ 
+-			if (isAjaxEnabled() || (is_null($entry['value']) || ! trim($entry['value']) || $entry['value']==$rule->getName())) {
+-				if ((! is_null($entry['value']) && $entry['value']==$rule->getName()) || ! trim($entry['value']))
++			if (isAjaxEnabled() || (is_null($entry['value']) || ! trim((string) $entry['value']) || $entry['value']==$rule->getName())) {
++				if ((! is_null($entry['value']) && $entry['value']==$rule->getName()) || ! trim((string) $entry['value']))
+ 					$entry['viewed'] = true;
+ 
+ 				if (null != $rule->getDescription())
+@@ -391,7 +391,7 @@ switch($entry['view']) {
+ 
+ 				if (isAjaxEnabled() && $entry['value'])
+ 					printf('<tr class="%s" id="mr%s" style="display: %s">',$counter%2 ? 'odd' : 'even',$rule->getName(),
+-						strcasecmp($entry['value'],$rule->getName()) ? 'none' : '');
++						strcasecmp((string) $entry['value'],(string) $rule->getName()) ? 'none' : '');
+ 				else
+ 					printf('<tr class="%s" id="mr%s">',$counter%2 ? 'odd' : 'even',$rule->getName());
+ 				printf('<td>%s</td>',$oid);
+@@ -467,12 +467,12 @@ switch($entry['view']) {
+ 		echo '<br />';
+ 
+ 		foreach ($socs as $name => $oclass) {
+-			if (isAjaxEnabled() || (is_null($entry['value']) || ! trim($entry['value']) || $entry['value']==$oclass->getName())) {
+-				if ((! is_null($entry['value']) && $entry['value']==$oclass->getName()) || ! trim($entry['value']))
++			if (isAjaxEnabled() || (is_null($entry['value']) || ! trim((string) $entry['value']) || $entry['value']==$oclass->getName())) {
++				if ((! is_null($entry['value']) && $entry['value']==$oclass->getName()) || ! trim((string) $entry['value']))
+ 					$entry['viewed'] = true;
+ 
+ 				if (isAjaxEnabled() && $entry['value'])
+-					printf('<div id="oc%s" style="display: %s">',$oclass->getName(),strcasecmp($entry['value'],$oclass->getName()) ? 'none' : '');
++					printf('<div id="oc%s" style="display: %s">',(string) $oclass->getName(),strcasecmp((string) $entry['value'],(string) $oclass->getName()) ? 'none' : '');
+ 				else
+ 					printf('<div id="oc%s">',$oclass->getName());
+ 
+@@ -494,10 +494,10 @@ switch($entry['view']) {
+ 
+ 				else
+ 					foreach ($oclass->getSupClasses() as $i => $object_class) {
+-						$href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower($object_class)));
++						$href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower((string) $object_class)));
+ 						if (isAjaxEnabled())
+ 							printf('<a href="cmd.php?%s" onclick="return ajSHOWSCHEMA(\'objectclasses\',\'oc\',\'%s\');">%s</a>',
+-								$href,strtolower($object_class),$object_class);
++								$href,strtolower((string) $object_class),$object_class);
+ 						else
+ 							printf('<a href="cmd.php?%s&viewvalue=%s" title="%s">%s</a>',
+ 								$href,$object_class,_('Jump to this objectClass definition'),$object_class);
+@@ -508,7 +508,7 @@ switch($entry['view']) {
+ 				echo '</b></td></tr>';
+ 
+ 				printf('<tr class="odd"><td colspan="4">%s: <b>',_('Parent to'));
+-				if (strcasecmp($oclass->getName(),'top') == 0) {
++				if (strcasecmp((string) $oclass->getName(),'top') == 0) {
+ 					$href = htmlspecialchars($entry['href']['objectclasses']);
+ 					if (isAjaxEnabled())
+ 						printf('<a href="cmd.php?%s" onclick="return ajSHOWSCHEMA(\'objectclasses\',\'oc\',\'\');">all</a>',
+@@ -521,10 +521,10 @@ switch($entry['view']) {
+ 
+ 				else
+ 					foreach ($oclass->getChildObjectClasses() as $i => $object_class) {
+-						$href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower($object_class)));
++						$href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower((string) $object_class)));
+ 						if (isAjaxEnabled())
+ 							printf('<a href="cmd.php?%s" title="%s" onclick="return ajSHOWSCHEMA(\'objectclasses\',\'oc\',\'%s\');">%s</a>',
+-								$href,_('Jump to this objectClass definition'),strtolower($object_class),$object_class);
++								$href,_('Jump to this objectClass definition'),strtolower((string) $object_class),$object_class);
+ 						else
+ 							printf('<a href="cmd.php?%s" title="%s">%s</a>',$href,_('Jump to this objectClass definition'),$object_class);
+ 
+@@ -553,11 +553,11 @@ switch($entry['view']) {
+ 
+ 						if ($attr->getSource() != $oclass->getName(false)) {
+ 							echo '<br />';
+-							$href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower($attr->getSource())));
++							$href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower((string) $attr->getSource())));
+ 							printf('<small>(%s ',_('Inherited from'));
+ 							if (isAjaxEnabled())
+ 								printf('<a href="cmd.php?%s" title="%s" onclick="return ajSHOWSCHEMA(\'objectclasses\',\'oc\',\'%s\');">%s</a>',
+-									$href,_('Jump to this objectClass definition'),strtolower($attr->getSource()),$attr->getSource());
++									$href,_('Jump to this objectClass definition'),strtolower((string) $attr->getSource()),$attr->getSource());
+ 							else
+ 								printf('<a href="cmd.php?%s">%s</a>',$href,$attr->getSource());
+ 							echo ')</small>';
+@@ -586,11 +586,11 @@ switch($entry['view']) {
+ 
+ 						if ($attr->getSource() != $oclass->getName(false)) {
+ 							echo '<br />';
+-							$href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower($attr->getSource())));
++							$href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower((string) $attr->getSource())));
+ 							printf('<small>(%s ',_('Inherited from'));
+ 							if (isAjaxEnabled())
+ 								printf('<a href="cmd.php?%s" title="%s" onclick="return ajSHOWSCHEMA(\'objectclasses\',\'oc\',\'%s\');">%s</a>',
+-									$href,_('Jump to this objectClass definition'),strtolower($attr->getSource()),$attr->getSource());
++									$href,_('Jump to this objectClass definition'),strtolower((string) $attr->getSource()),$attr->getSource());
+ 							else
+ 								printf('<a href="cmd.php?%s">%s</a>',$href,$attr->getSource());
+ 							echo ')</small>';
diff --git a/net/phpldapadmin/files/patch-htdocs_server__info.php b/net/phpldapadmin/files/patch-htdocs_server__info.php
new file mode 100644
index 000000000000..cf3ce2cf59ed
--- /dev/null
+++ b/net/phpldapadmin/files/patch-htdocs_server__info.php
@@ -0,0 +1,20 @@
+--- htdocs/server_info.php.orig	2021-12-12 02:35:51 UTC
++++ htdocs/server_info.php
+@@ -60,7 +60,7 @@ foreach ($attrs as $key => $values) {
+ 						printf('<td>%s</td>',$oidtext['title']);
+ 
+ 				else
+-					if (strlen($value) > 0)
++					if (strlen((string) $value) > 0)
+ 						printf('<td><small>%s</small></td>',$value);
+ 
+ 			} else {
+@@ -69,7 +69,7 @@ foreach ($attrs as $key => $values) {
+ 
+ 			print '</tr>';
+ 
+-			if (isset($oidtext['desc']) && trim($oidtext['desc']))
++			if (isset($oidtext['desc']) && trim((string) $oidtext['desc']))
+ 				printf('<tr><td><small>%s</small></td></tr>',$oidtext['desc']);
+ 			else
+ 				echo '<tr><td>&nbsp;</td></tr>';
diff --git a/net/phpldapadmin/files/patch-htdocs_view__jpeg__photo.php b/net/phpldapadmin/files/patch-htdocs_view__jpeg__photo.php
new file mode 100644
index 000000000000..ee1c236eac4e
--- /dev/null
+++ b/net/phpldapadmin/files/patch-htdocs_view__jpeg__photo.php
@@ -0,0 +1,11 @@
+--- htdocs/view_jpeg_photo.php.orig	2021-12-12 02:35:51 UTC
++++ htdocs/view_jpeg_photo.php
+@@ -15,7 +15,7 @@ require './common.php';
+ 
+ $request = array();
+ $request['dn'] = get_request('dn','GET');
+-$request['attr'] = strtolower(get_request('attr','GET',false,'jpegphoto'));
++$request['attr'] = strtolower((string) get_request('attr','GET',false,'jpegphoto'));
+ $request['index'] = get_request('index','GET',false,0);
+ $request['type'] = get_request('type','GET',false,'image/jpeg');
+ $request['filename'] = get_request('filename','GET',false,sprintf('%s.jpg',get_rdn($request['dn'],true)));
diff --git a/net/phpldapadmin/files/patch-lib_AJAXTree.php b/net/phpldapadmin/files/patch-lib_AJAXTree.php
new file mode 100644
index 000000000000..6cbe8ba84deb
--- /dev/null
+++ b/net/phpldapadmin/files/patch-lib_AJAXTree.php
@@ -0,0 +1,47 @@
+--- lib/AJAXTree.php.orig	2021-12-12 02:35:51 UTC
++++ lib/AJAXTree.php
+@@ -31,7 +31,7 @@ class AJAXTree extends HTMLTree {
+ 		# Level pre-treatment
+ 		$code = '';
+ 		if (is_string($level)) {
+-			for ($i=0; $i<strlen($level); $i++) {
++			for ($i=0; $i<strlen((string) $level); $i++) {
+ 				if ($level[$i] == '0')
+ 					$code .= '0';
+ 				elseif ($level[$i] == '1')
+@@ -41,7 +41,7 @@ class AJAXTree extends HTMLTree {
+ 		} elseif ($level > 0)
+ 			$code = '0' * $level;
+ 
+-		$level = strlen($code);
++		$level = strlen((string) $code);
+ 
+ 		# Get entry to display as node
+ 		$entry = $this->getEntry($item);
+@@ -189,7 +189,7 @@ class AJAXTree extends HTMLTree {
+ 
+ 		$indent = '';
+ 
+-		for ($i=0; $i<strlen($code); $i++) {
++		for ($i=0; $i<strlen((string) $code); $i++) {
+ 			switch ($code[$i]) {
+ 				case '0':
+ 					$indent .= sprintf('<img src="%s/tree_space.png" alt="  " class="imgs" style="border: 0px; vertical-align:text-top;" />',IMGDIR);
+@@ -223,7 +223,7 @@ class AJAXTree extends HTMLTree {
+ 		if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
+ 			debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
+ 
+-		if (strlen($level) == 0)
++		if (strlen((string) $level) == 0)
+ 			return '';
+ 
+ 		$server = $this->getServer();
+@@ -243,7 +243,7 @@ class AJAXTree extends HTMLTree {
+ 		if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
+ 			debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
+ 
+-		if (strlen($level) == 0)
++		if (strlen((string) $level) == 0)
+ 			return '';
+ 
+ 		$server = $this->getServer();
diff --git a/net/phpldapadmin/files/patch-lib_Attribute.php b/net/phpldapadmin/files/patch-lib_Attribute.php
index 52a760568e4b..4d3d129dd577 100644
--- a/net/phpldapadmin/files/patch-lib_Attribute.php
+++ b/net/phpldapadmin/files/patch-lib_Attribute.php
@@ -1,11 +1,59 @@
 --- 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
+@@ -133,9 +133,9 @@ class PLAAttribute {
+ 			debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs,$this->name);
+ 
+ 		if ($real)
+-			return $lower ? strtolower($this->name) : $this->name;
++			return $lower ? strtolower((string) $this->name) : $this->name;
+ 		else
+-			return $lower ? strtolower($this->real_attr_name()) : $this->real_attr_name();
++			return $lower ? strtolower((string) $this->real_attr_name()) : $this->real_attr_name();
+ 	}
+ 
+ 	public function getValues() {
+@@ -389,7 +389,7 @@ class PLAAttribute {
+ 		if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
+ 			debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);
+ 
+-		$this->type = strtolower($type);
++		$this->type = strtolower((string) $type);
+ 	}
+ 
+ 	public function getType() {
+@@ -403,7 +403,7 @@ class PLAAttribute {
+ 		if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
+ 			debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs);
+ 
+-		$this->ldaptype = strtolower($type);
++		$this->ldaptype = strtolower((string) $type);
+ 	}
+ 
+ 	public function getLDAPtype() {
+@@ -671,7 +671,7 @@ class PLAAttribute {
+ 
+ 		# Store our Aliases
+ 		foreach ($sattr->getAliases() as $alias)
+-			array_push($this->aliases,strtolower($alias));
++			array_push($this->aliases,strtolower((string) $alias));
+ 
+ 		if ($sattr->getIsSingleValue())
+ 			$this->setMaxValueCount(1);
+@@ -840,7 +840,7 @@ class PLAAttribute {
+ 								'type'=>'warn'));
+ 				}
+ 
+-		elseif (is_string($values) && (strlen($values) > 0))
++		elseif (is_string($values) && (strlen((string) $values) > 0))
+ 			$this->values = array($values);
+ 	}
+ 
+@@ -877,7 +877,7 @@ class PLAAttribute {
+ 		if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
+ 			debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->name);
+ 
+-		return preg_replace('/;.*$/U','',$this->name);
++		return preg_replace('/;.*$/U','',is_null($this->name)? "":$this->name);
+ 	}
+ 
+ 	/**
diff --git a/net/phpldapadmin/files/patch-lib_AttributeFactory.php b/net/phpldapadmin/files/patch-lib_AttributeFactory.php
index 7bbd14ea5b12..12488014c85c 100644
--- a/net/phpldapadmin/files/patch-lib_AttributeFactory.php
+++ b/net/phpldapadmin/files/patch-lib_AttributeFactory.php
@@ -1,11 +1,50 @@
 --- lib/AttributeFactory.php.orig	2021-12-12 02:35:51 UTC
 +++ lib/AttributeFactory.php
-@@ -133,7 +133,7 @@ class AttributeFactory {
+@@ -83,7 +83,7 @@ class AttributeFactory {
+ 		if (isset($values['type']))
+ 			switch ($values['type']) {
+ 				case 'password':
+-					if (! strcasecmp($name,'sambaLMPassword') || ! strcasecmp($name,'sambaNTPassword'))
++					if (! strcasecmp((string) $name,'sambaLMPassword') || ! strcasecmp((string) $name,'sambaNTPassword'))
+ 						return $this->newSambaPasswordAttribute($name,$values,$server_id,$source);
+ 					else
+ 						return $this->newPasswordAttribute($name,$values,$server_id,$source);
+@@ -96,7 +96,7 @@ class AttributeFactory {
+ 					return $this->newMultiLineAttribute($name,$values,$server_id,$source);
+ 			}
+ 
+-		if (! strcasecmp($name,'objectClass')) {
++		if (! strcasecmp((string) $name,'objectClass')) {
+ 			return $this->newObjectClassAttribute($name,$values,$server_id,$source);
+ 
+ 		} elseif ($app['server']->isJpegPhoto($name) || in_array($name,$app['server']->getValue('server','jpeg_attributes'))) {
+@@ -105,16 +105,16 @@ class AttributeFactory {
+ 		} elseif ($app['server']->isAttrBinary($name)) {
+ 			return $this->newBinaryAttribute($name,$values,$server_id,$source);
+ 
+-		} elseif (! strcasecmp($name,'userPassword')) {
++		} elseif (! strcasecmp((string) $name,'userPassword')) {
+ 			return $this->newPasswordAttribute($name,$values,$server_id,$source);
+ 
+-		} elseif (! strcasecmp($name,'sambaLMPassword') || ! strcasecmp($name,'sambaNTPassword')) {
++		} elseif (! strcasecmp((string) $name,'sambaLMPassword') || ! strcasecmp((string) $name,'sambaNTPassword')) {
+ 			return $this->newSambaPasswordAttribute($name,$values,$server_id,$source);
+ 
+-		} elseif (in_array(strtolower($name),array_keys(array_change_key_case($_SESSION[APPCONFIG]->getValue('appearance','date_attrs'))))) {
++		} elseif (in_array(strtolower((string) $name),array_keys(array_change_key_case($_SESSION[APPCONFIG]->getValue('appearance','date_attrs'))))) {
+ 			return $this->newDateAttribute($name,$values,$server_id,$source);
+ 
+-		} elseif (in_array(strtolower($name),array('shadowlastchange','shadowmin','shadowmax','shadowexpire','shadowwarning','shadowinactive'))) {
++		} elseif (in_array(strtolower((string) $name),array('shadowlastchange','shadowmin','shadowmax','shadowexpire','shadowwarning','shadowinactive'))) {
+ 			return $this->newShadowAttribute($name,$values,$server_id,$source);
+ 
+ 		} elseif ($app['server']->isAttrBoolean($name)) {
+@@ -129,7 +129,7 @@ class AttributeFactory {
+ 		} elseif ($app['server']->isMultiLineAttr($name)) {
+ 			return $this->newMultiLineAttribute($name,$values,$server_id,$source);
+ 
+-		} elseif (! strcasecmp($name,'gidNumber')) {
++		} elseif (! strcasecmp((string) $name,'gidNumber')) {
  			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_HTMLTree.php b/net/phpldapadmin/files/patch-lib_HTMLTree.php
new file mode 100644
index 000000000000..bcd63afee7ee
--- /dev/null
+++ b/net/phpldapadmin/files/patch-lib_HTMLTree.php
@@ -0,0 +1,32 @@
+--- lib/HTMLTree.php.orig	2021-12-12 02:35:51 UTC
++++ lib/HTMLTree.php
+@@ -168,9 +168,10 @@ class HTMLTree extends Tree {
+ 		printf('<td class="name" colspan="%s">',$this->getDepth()+3-1);
+ 		printf('%s',$server->getName());
+ 
++		//		strftime('%H:%M',$server->inactivityTime()));
+ 		if (! is_null($server->inactivityTime())) {
+ 			$m = sprintf(_('Inactivity will log you off at %s'),
+-				strftime('%H:%M',$server->inactivityTime()));
++				date('H:i',$server->inactivityTime()));
+ 			printf(' <img width="14" height="14" src="%s/timeout.png" title="%s" alt="%s"/>',IMGDIR,$m,'Timeout');
+ 		}
+ 		echo '</td></tr>';
+@@ -361,7 +362,7 @@ class HTMLTree extends Tree {
+ 			$logged_in_dn_array = array();
+ 
+ 		} else {
+-			$logged_in_branch = preg_replace('/,'.$server->getContainerTop($logged_in_dn).'$/','',$logged_in_dn);
++			$logged_in_branch = preg_replace('/,'.$server->getContainerTop($logged_in_dn).'$/','',is_null($logged_in_dn)? "":$logged_in_dn);
+ 			$logged_in_dn_array = pla_explode_dn($logged_in_branch);
+ 		}
+ 
+@@ -375,7 +376,7 @@ class HTMLTree extends Tree {
+ 		if (! is_array($logged_in_dn_array))
+ 			$logged_in_dn_array = array($logged_in_dn);
+ 
+-		if (trim($logged_in_dn)) {
++		if (trim((string) $logged_in_dn)) {
+ 			if ($server->dnExists($logged_in_dn))
+ 				foreach ($logged_in_dn_array as $rdn_piece) {
+ 					$href = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s',$server->getIndex(),rawurlencode($rdn));
diff --git a/net/phpldapadmin/files/patch-lib_PageRender.php b/net/phpldapadmin/files/patch-lib_PageRender.php
index 95429c3281ec..f97df7e2ebaf 100644
--- a/net/phpldapadmin/files/patch-lib_PageRender.php
+++ b/net/phpldapadmin/files/patch-lib_PageRender.php
@@ -1,31 +1,120 @@
 --- 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;
+@@ -182,7 +182,7 @@ class PageRender extends Visitor {
+ 						$attribute2 = $this->template->getAttribute($joinattr);
  
--		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);
- 	}
+ 						if (! $attribute2) {
+-							if (($pv = get_request(strtolower($joinattr),'REQUEST')) && isset($pv[$attribute->getName()][$i])) {
++							if (($pv = get_request(strtolower((string) $joinattr),'REQUEST')) && isset($pv[$attribute->getName()][$i])) {
+ 								array_push($values,$pv[$attribute->getName()][$i]);
  
- 	/**
-@@ -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);
- 	}
+ 								if (! $pv[$attribute->getName()][$i])
+@@ -242,7 +242,7 @@ class PageRender extends Visitor {
+ 					return;
+ 
+ 				# Get the attribute.
+-				if (preg_match_all('/%(\w+)(\|.+)?(\/[lU])?%/U',strtolower($args[1]),$matchall)) {
++				if (preg_match_all('/%(\w+)(\|.+)?(\/[lU])?%/U',strtolower((string) $args[1]),$matchall)) {
+ 					if (count($matchall[1]) != 1)
+ 						system_message(array(
+ 							'title'=>_('Invalid value count for PasswordEncrypt'),
+@@ -255,11 +255,11 @@ class PageRender extends Visitor {
+ 				} else
+ 					$passwordvalue = $args[1];
+ 
+-				if (! trim($passwordvalue) || in_array($passwordvalue,$attribute->getOldValues()))
++				if (! trim((string) $passwordvalue) || in_array($passwordvalue,$attribute->getOldValues()))
+ 					return;
+ 
+ 				# Get the encoding
+-				if ($passwordattr && preg_match_all('/%(\w+)(\|.+)?(\/[lU])?%/U',strtolower($args[0]),$matchall)) {
++				if ($passwordattr && preg_match_all('/%(\w+)(\|.+)?(\/[lU])?%/U',strtolower((string) $args[0]),$matchall)) {
+ 					if (count($matchall[1]) != 1)
+ 						system_message(array(
+ 							'title'=>_('Invalid value count for PasswordEncrypt'),
+@@ -271,7 +271,7 @@ class PageRender extends Visitor {
+ 				} else
+ 					$enc = $args[0];
+ 
+-				$enc = strtolower($enc);
++				$enc = strtolower((string) $enc);
+ 
+ 				switch ($enc) {
+ 					case 'lm':
+@@ -403,7 +403,7 @@ class PageRender extends Visitor {
+ 			$alias_note = $this->get($note,$attribute);
+ 
+ 			if ($alias_note) {
+-				if (trim($attr_note))
++				if (trim((string) $attr_note))
+ 					$attr_note .= ', ';
+ 
+ 				$attr_note .= $alias_note;
+@@ -423,7 +423,7 @@ class PageRender extends Visitor {
+ 		# Is there a user-friendly translation available for this attribute?
+ 		$friendly_name = $attribute->getFriendlyName();
  
- 	protected function drawFormReadOnlyValueJpegAttribute($attribute,$i) {
- 		$this->draw('HiddenValue',$attribute,$i);
- 		$_SESSION['tmp'][$attribute->getName()][$i] = $attribute->getValue($i);
+-		if (strtolower($friendly_name) != $attribute->getName())
++		if (strtolower((string) $friendly_name) != $attribute->getName())
+ 			return sprintf('<acronym title="%s: \'%s\' %s \'%s\'">%s</acronym>',
+ 				_('Note'),$friendly_name,_('is an alias for'),$attribute->getName(false),_('alias'));
+ 		else
+@@ -954,7 +954,7 @@ class PageRender extends Visitor {
+ 		$server = $this->getServer();
+ 		$val = $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);
+-		if (trim($val))
++		if (trim((string) $val))
+ 			$enc_type = get_enc_type($val);
+ 		else
+ 			$enc_type = $server->getValue('appearance','pla_password_hash');
+@@ -966,7 +966,7 @@ class PageRender extends Visitor {
+ 			htmlspecialchars($attribute->getName()),$i,htmlspecialchars($attribute->getName()),
+ 			$i,htmlspecialchars($val),($attribute->getSize() > 0) ? 'size="'.$attribute->getSize().'"' : '');
+ 
+-		if (trim($val))
++		if (trim((string) $val))
+ 			$this->draw('CheckLink',$attribute,'new_values_'.htmlspecialchars($attribute->getName()).'_'.$i);
  	}
  
- 	protected function drawFormReadOnlyValueMultiLineAttribute($attribute,$i) {
+@@ -979,7 +979,7 @@ class PageRender extends Visitor {
+ 		$enc_type = get_enc_type($val);
+ 
+ 		# Set the default hashing type if the password is blank (must be newly created)
+-		if (trim($val))
++		if (trim((string) $val))
+ 			$enc_type = get_enc_type($val);
+ 		else
+ 			$enc_type = $server->getValue('appearance','pla_password_hash');
+@@ -1125,7 +1125,7 @@ class PageRender extends Visitor {
+ 
+ 			foreach ($attribute->getSelection() as $value => $description) {
+ 				printf('<option value="%s" %s>%s</option>',$value,
+-					((strcasecmp($value,$val) == 0) && $found = true) ? 'selected="selected"' : '',$description);
++					((strcasecmp((string) $value,(string) $val) == 0) && (string) $found = true) ? 'selected="selected"' : '',(string) $description);
+ 
+ 				if ($value == '')
+ 					$empty_value = true;
+@@ -1140,7 +1140,7 @@ class PageRender extends Visitor {
+ 				echo "\n";
+ 			}
+ 
+-			if ((strlen($val) > 0) && ! $empty_value && $this->template->getDN()) {
++			if ((strlen((string) $val) > 0) && ! $empty_value && $this->template->getDN()) {
+ 				printf('<option value="">(%s)</option>',_('none, remove value'));
+ 				echo "\n";
+ 			}
+@@ -1212,11 +1212,11 @@ class PageRender extends Visitor {
+ 		$today = date('U');
+ 
+ 		echo '<br/><small>';
+-		if (($today < $shadow_date) && in_array(strtolower($attribute->getName()),$shadow_before_today_attrs))
++		if (($today < $shadow_date) && in_array(strtolower((string) $attribute->getName()),$shadow_before_today_attrs))
+ 			printf('<span style="color:red">(%s)</span>',
+ 				strftime($_SESSION[APPCONFIG]->getValue('appearance','date'),$shadow_date));
+ 
+-		elseif (($today > $shadow_date) && in_array(strtolower($attribute->getName()),$shadow_after_today_attrs))
++		elseif (($today > $shadow_date) && in_array(strtolower((string) $attribute->getName()),$shadow_after_today_attrs))
+ 			printf('<span style="color:red">(%s)</span>',
+ 				strftime($_SESSION[APPCONFIG]->getValue('appearance','date'),$shadow_date));
+ 
diff --git a/net/phpldapadmin/files/patch-lib_Query.php b/net/phpldapadmin/files/patch-lib_Query.php
new file mode 100644
index 000000000000..21d5f9b7b896
--- /dev/null
+++ b/net/phpldapadmin/files/patch-lib_Query.php
@@ -0,0 +1,68 @@
+--- lib/Query.php.orig	2021-12-12 02:35:51 UTC
++++ lib/Query.php
+@@ -87,9 +87,9 @@ class Query extends xmlTemplate {
+ 					if (in_array($xml_key,$storelower))
+ 						if (is_array($xml_value))
+ 							foreach ($xml_value as $index => $value)
+-								$xml_value[$index] = strtolower($value);
++								$xml_value[$index] = strtolower((string) $value);
+ 						else
+-							$xml_value = strtolower($xml_value);
++							$xml_value = strtolower((string) $xml_value);
+ 
+ 					# Items that must be stored as arrays
+ 					if (in_array($xml_key,$storearray) && ! is_array($xml_value))
+@@ -109,7 +109,7 @@ class Query extends xmlTemplate {
+ 		# Check we have some manditory items.
+ 		foreach (array() as $key) {
+ 			if (! isset($this->$key)
+-				|| (! is_array($this->$key) && ! trim($this->$key))) {
++				|| (! is_array($this->$key) && ! trim((string) $this->$key))) {
+ 
+ 				$this->setInvalid(sprintf(_('Missing %s in the XML file.'),$key));
+ 				break;
+@@ -138,7 +138,7 @@ class Query extends xmlTemplate {
+ 			$query['scope'] = get_request('scope','REQUEST',false,'sub');
+ 			$attrs = get_request('display_attrs','REQUEST');
+ 
+-			$attrs = preg_replace('/\s+/','',$attrs);
++			$attrs = preg_replace('/\s+/','',is_null($attrs)? "":$attrs);
+ 			if ($attrs)
+ 				$query['attrs'] = explode(',',$attrs);
+ 			else
+@@ -198,9 +198,9 @@ class Query extends xmlTemplate {
+ 	public function getDNEncode($url=true) {
+ 		// @todo Be nice to do all this in 1 location
+ 		if ($url)
+-			return urlencode(preg_replace('/%([0-9a-fA-F]+)/',"%25\\1",$this->dn));
++			return urlencode(preg_replace('/%([0-9a-fA-F]+)/',"%25\\1",is_null($this->dn)? "":$this->dn));
+ 		else
+-			return preg_replace('/%([0-9a-fA-F]+)/',"%25\\1",$this->dn);
++			return preg_replace('/%([0-9a-fA-F]+)/',"%25\\1",is_null($this->dn)? "":$this->dn);
+ 	}
+ 
+ 	public function getAttrSortOrder() {
+@@ -216,9 +216,9 @@ class Query extends xmlTemplate {
+ 				array_push($result,$attribute->getName());
+ 
+ 		} else {
+-			$display = preg_replace('/,\s+/',',',get_request('orderby','REQUEST',false,'dn'));
++			$display = preg_replace('/,\s+/',',',get_request('orderby','REQUEST',false,is_null('dn')? "":'dn'));
+ 
+-			if (trim($display))
++			if (trim((string) $display))
+ 				$result = explode(',',$display);
+ 		}
+ 
+@@ -238,9 +238,9 @@ class Query extends xmlTemplate {
+ 				array_push($result,$attribute->getName());
+ 
+ 		} else {
+-			$display = preg_replace('/,\s+/',',',get_request('display_attrs','REQUEST',false,''));
++			$display = preg_replace('/,\s+/',',',get_request('display_attrs','REQUEST',false,is_null('')? "":''));
+ 
+-			if (trim($display))
++			if (trim((string) $display))
+ 				$result = explode(',',$display);
+ 		}
+ 
diff --git a/net/phpldapadmin/files/patch-lib_QueryRender.php b/net/phpldapadmin/files/patch-lib_QueryRender.php
new file mode 100644
index 000000000000..ee9255bd6c83
--- /dev/null
+++ b/net/phpldapadmin/files/patch-lib_QueryRender.php
@@ -0,0 +1,38 @@
+--- lib/QueryRender.php.orig	2021-12-12 02:35:51 UTC
++++ lib/QueryRender.php
+@@ -280,7 +280,7 @@ class QueryRender extends PageRender {
+ 
+ 						# Iterate over each attribute for this entry
+ 						foreach (explode(',',$ado) as $attr) {
+-							$attr = strtolower($attr);
++							$attr = strtolower((string) $attr);
+ 
+ 							# Ignore DN, we've already displayed it.
+ 							if ($attr == 'dn')
+@@ -379,7 +379,7 @@ class QueryRender extends PageRender {
+ 
+ 							# Special case for DNs
+ 							if ($attr == 'dn') {
+-								$dn_display = strlen($dndetails['dn']) > 40
++								$dn_display = strlen((string) $dndetails['dn']) > 40
+ 									? sprintf('<acronym title="%s">%s...</acronym>',htmlspecialchars($dndetails['dn']),htmlspecialchars(substr($dndetails['dn'],0,40)))
+ 									: htmlspecialchars($dndetails['dn']);
+ 
+@@ -461,7 +461,7 @@ class QueryRender extends PageRender {
+ 		$results = array();
+ 
+ 		foreach (explode(',',$this->template->getAttrDisplayOrder()) as $attr)
+-			$results[strtolower($attr)] = $attribute_factory->newAttribute($attr,array('values'=>array()),$this->getServerID());
++			$results[strtolower((string) $attr)] = $attribute_factory->newAttribute($attr,array('values'=>array()),$this->getServerID());
+ 
+ 		return $results;
+ 	}
+@@ -470,7 +470,7 @@ class QueryRender extends PageRender {
+ 		if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
+ 			debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs);
+ 
+-		return preg_replace('/=/','.',base64_encode($dn));
++		return preg_replace('/=/','.',is_null(base64_encode($dn)? "":base64_encode($dn));
+ 	}
+ 
+ 	private function drawBaseTabs() {
diff --git a/net/phpldapadmin/files/patch-lib_Template.php b/net/phpldapadmin/files/patch-lib_Template.php
*** 2164 LINES SKIPPED ***