';
+ echo '
';
+@@ -91,12 +91,12 @@ if (! strcasecmp($request['attr'],'objectclass') || ge
+ printf('
%s | ',_('Enter the value(s) you would like to add:'));
+ echo '
';
+
+- 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 '';
diff --git a/net/phpldapadmin/files/patch-htdocs_cmd.php b/net/phpldapadmin/files/patch-htdocs_cmd.php
new file mode 100644
--- /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
--- /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
--- /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
--- /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
--- /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
--- /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 ' ';
+ $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
--- /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('%s | ',$description,$dn);
+ echo '';
diff --git a/net/phpldapadmin/files/patch-htdocs_purge__cache.php b/net/phpldapadmin/files/patch-htdocs_purge__cache.php
new file mode 100644
--- /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
--- /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 %s.
%s',
+@@ -149,12 +149,12 @@ switch($entry['view']) {
+ echo ' ';
+
+ 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('',$attr->getName(),strcasecmp($entry['value'],$attr->getName()) ? 'none' : 'block');
++ printf(' ',(string) $attr->getName(),strcasecmp((string) $entry['value'],(string) $attr->getName()) ? 'none' : 'block');
+ else
+ printf(' ',$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(' %s',
+- $href,strtolower($attr->getSupAttribute()),$attr->getSupAttribute());
++ $href,strtolower((string) $attr->getSupAttribute()),$attr->getSupAttribute());
+ else
+ printf(' %s',$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(' %s',
+- $href,strtolower($alias),$alias);
++ $href,strtolower((string) $alias),$alias);
+ else
+ printf(' %s',$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(' %s ',
+- $href,$href,_('ObjectClasses'),strtolower($objectclass),$objectclass);
++ $href,$href,_('ObjectClasses'),strtolower((string) $objectclass),$objectclass);
+ else
+ printf(' %s ',$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(' ',$counter%2 ? 'odd' : 'even',$rule->getName(),
+- strcasecmp($entry['value'],$rule->getName()) ? 'none' : '');
++ strcasecmp((string) $entry['value'],(string) $rule->getName()) ? 'none' : '');
+ else
+ printf(' ',$counter%2 ? 'odd' : 'even',$rule->getName());
+ printf('%s | ',$oid);
+@@ -467,12 +467,12 @@ switch($entry['view']) {
+ echo ' ';
+
+ 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('',$oclass->getName(),strcasecmp($entry['value'],$oclass->getName()) ? 'none' : '');
++ printf(' ',(string) $oclass->getName(),strcasecmp((string) $entry['value'],(string) $oclass->getName()) ? 'none' : '');
+ else
+ printf(' ',$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(' %s',
+- $href,strtolower($object_class),$object_class);
++ $href,strtolower((string) $object_class),$object_class);
+ else
+ printf(' %s',
+ $href,$object_class,_('Jump to this objectClass definition'),$object_class);
+@@ -508,7 +508,7 @@ switch($entry['view']) {
+ echo ' ';
+
+ printf(' %s: ',_('Parent to'));
+- if (strcasecmp($oclass->getName(),'top') == 0) {
++ if (strcasecmp((string) $oclass->getName(),'top') == 0) {
+ $href = htmlspecialchars($entry['href']['objectclasses']);
+ if (isAjaxEnabled())
+ printf('all',
+@@ -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('%s',
+- $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('%s',$href,_('Jump to this objectClass definition'),$object_class);
+
+@@ -553,11 +553,11 @@ switch($entry['view']) {
+
+ if ($attr->getSource() != $oclass->getName(false)) {
+ echo ' ';
+- $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('(%s ',_('Inherited from'));
+ if (isAjaxEnabled())
+ printf('%s',
+- $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('%s',$href,$attr->getSource());
+ echo ')';
+@@ -586,11 +586,11 @@ switch($entry['view']) {
+
+ if ($attr->getSource() != $oclass->getName(false)) {
+ echo ' ';
+- $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('(%s ',_('Inherited from'));
+ if (isAjaxEnabled())
+ printf('%s',
+- $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('%s',$href,$attr->getSource());
+ echo ')';
diff --git a/net/phpldapadmin/files/patch-htdocs_server__info.php b/net/phpldapadmin/files/patch-htdocs_server__info.php
new file mode 100644
--- /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(' | %s | ',$oidtext['title']);
+
+ else
+- if (strlen($value) > 0)
++ if (strlen((string) $value) > 0)
+ printf('%s | ',$value);
+
+ } else {
+@@ -69,7 +69,7 @@ foreach ($attrs as $key => $values) {
+
+ print ' ';
+
+- if (isset($oidtext['desc']) && trim($oidtext['desc']))
++ if (isset($oidtext['desc']) && trim((string) $oidtext['desc']))
+ printf(' %s | ',$oidtext['desc']);
+ else
+ echo ' | ';
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
--- /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
--- /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 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',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
--- 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
--- 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
--- /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('',$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(' ',IMGDIR,$m,'Timeout');
+ }
+ echo ' | | ';
+@@ -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
--- 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('%s',
+ _('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('',$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('',_('none, remove value'));
+ echo "\n";
+ }
+@@ -1212,11 +1212,11 @@ class PageRender extends Visitor {
+ $today = date('U');
+
+ echo ' ';
+- 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('(%s)',
+ 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('(%s)',
+ 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
--- /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
--- /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('%s...',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
new file mode 100644
--- /dev/null
+++ b/net/phpldapadmin/files/patch-lib_Template.php
@@ -0,0 +1,248 @@
+--- lib/Template.php.orig 2021-12-12 02:35:51 UTC
++++ lib/Template.php
+@@ -100,7 +100,7 @@ class Template extends xmlTemplate {
+ foreach ($xmldata['template'][$xml_key]['objectclass'] as $index => $details) {
+
+ # XML files with only 1 objectClass dont have a numeric index.
+- $soc = $server->getSchemaObjectClass(strtolower($details));
++ $soc = $server->getSchemaObjectClass(strtolower((string) $details));
+
+ # If we havent recorded this objectclass already, do so now.
+ if (is_object($soc) && ! in_array($soc->getName(),$objectclasses))
+@@ -115,7 +115,7 @@ class Template extends xmlTemplate {
+
+ } else {
+ # XML files with only 1 objectClass dont have a numeric index.
+- $soc = $server->getSchemaObjectClass(strtolower($xmldata['template'][$xml_key]['objectclass']));
++ $soc = $server->getSchemaObjectClass(strtolower((string) $xmldata['template'][$xml_key]['objectclass']));
+
+ # If we havent recorded this objectclass already, do so now.
+ if (is_object($soc) && ! in_array($soc->getName(),$objectclasses))
+@@ -160,9 +160,9 @@ class Template 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))
+@@ -198,7 +198,7 @@ class Template extends xmlTemplate {
+ # Check we have some manditory items.
+ foreach (array('rdn','structural_oclass','visible') 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;
+@@ -272,7 +272,7 @@ class Template extends xmlTemplate {
+ 'body'=>sprintf('DN (%s) didnt exist in LDAP?',$this->dn),
+ 'type'=>'info'));
+
+- $rdnarray = rdn_explode(strtolower(get_rdn(dn_escape($this->dn))));
++ $rdnarray = rdn_explode(strtolower((string) get_rdn(dn_escape($this->dn))));
+
+ $counter = 1;
+ foreach ($server->getDNAttrValues($this->dn,null,LDAP_DEREF_NEVER,array_merge(array('*'),$server->getValue('server','custom_attrs')),$nocache) as $attr => $values) {
+@@ -298,7 +298,7 @@ class Template extends xmlTemplate {
+ # Work out the RDN attributes
+ foreach ($attribute->getValues() as $index => $value)
+ if (in_array(sprintf('%s=%s',
+- $attribute->getName(),strtolower($attribute->getValue($index))),$rdnarray))
++ $attribute->getName(),strtolower((string) $attribute->getValue($index))),$rdnarray))
+ $attribute->setRDN($counter++);
+
+ if ($makeVisible)
+@@ -355,7 +355,7 @@ class Template extends xmlTemplate {
+
+ # Prune out entries with a blank value.
+ foreach ($values as $index => $value)
+- if (! strlen(trim($value)))
++ if (! strlen((string) trim((string) $value)))
+ unset($values[$index]);
+
+ $attribute = $this->getAttribute($attr);
+@@ -603,7 +603,7 @@ class Template extends xmlTemplate {
+ foreach ($rdnarray as $index => $rdnattr) {
+ list($attr,$value) = explode('=',$rdnattr);
+
+- if (strtolower($attr) == $attribute->getName()) {
++ if (strtolower((string) $attr) == $attribute->getName()) {
+ $attribute->setRDN($counter++);
+ unset($rdnarray[$index]);
+ }
+@@ -637,9 +637,9 @@ class Template 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->getDN()));
++ return urlencode(preg_replace('/%([0-9a-fA-F]+)/',"%25\\1",is_null($this->getDN())? "":$this->getDN()));
+ else
+- return preg_replace('/%([0-9a-fA-F]+)/',"%25\\1",$this->getDN());
++ return preg_replace('/%([0-9a-fA-F]+)/',"%25\\1",is_null($this->getDN())? "":$this->getDN());
+ }
+
+ /**
+@@ -676,9 +676,9 @@ class Template extends xmlTemplate {
+ public function getContainerEncode($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->container));
++ return urlencode(preg_replace('/%([0-9a-fA-F]+)/',"%25\\1",is_null($this->container)? "":$this->container));
+ else
+- return preg_replace('/%([0-9a-fA-F]+)/',"%25\\1",$this->container);
++ return preg_replace('/%([0-9a-fA-F]+)/',"%25\\1",is_null($this->container)? "":$this->container);
+ }
+
+ /**
+@@ -707,7 +707,7 @@ class Template extends xmlTemplate {
+ $modified = false;
+ foreach ($rdnarray as $index => $rdnattr) {
+ list($attr,$value) = explode('=',$rdnattr);
+- if (strtolower($attr) == $attribute->getName()) {
++ if (strtolower((string) $attr) == $attribute->getName()) {
+
+ # If this is already marked as an RDN, then this multivalue RDN was updated on a previous loop
+ if (! $modified) {
+@@ -726,7 +726,7 @@ class Template extends xmlTemplate {
+ }
+
+ // @todo If this is a Jpeg Attribute, we need to mark it read only, since it cant be deleted like text attributes can
+- if (strcasecmp(get_class($attribute),'jpegAttribute') == 0)
++ if (strcasecmp(get_class((string) $attribute),'jpegAttribute') == 0)
+ $attribute->setReadOnly();
+ }
+
+@@ -761,7 +761,7 @@ class Template extends xmlTemplate {
+ $result = array();
+
+ foreach ($this->attributes as $index => $attribute) {
+- if ($attribute->getLDAPtype() == strtolower($type))
++ if ($attribute->getLDAPtype() == strtolower((string) $type))
+ array_push($result,$attribute->getName());
+ }
+
+@@ -775,7 +775,7 @@ class Template extends xmlTemplate {
+ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
+ debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
+
+- if (in_array(strtolower($attr),$this->getAttrbyLdapType($type)))
++ if (in_array(strtolower((string) $attr),$this->getAttrbyLdapType($type)))
+ return true;
+ else
+ return false;
+@@ -856,7 +856,7 @@ class Template extends xmlTemplate {
+ }
+
+ # Chop the last plus sign off when returning
+- return preg_replace('/\+$/','',$rdn);
++ return preg_replace('/\+$/','',is_null($rdn)? "":$rdn);
+ }
+
+ /**
+@@ -1166,25 +1166,25 @@ class Template extends xmlTemplate {
+ $attribute->js['autoFill'] = '';
+
+ $formula = $string;
+- $formula = preg_replace('/^([^%])/','\'$1',$formula);
+- $formula = preg_replace('/([^%])$/','$1\'',$formula);
++ $formula = preg_replace('/^([^%])/','\'$1',is_null($formula)? "":$formula);
++ $formula = preg_replace('/([^%])$/','$1\'',is_null($formula)? "":$formula);
+
+ # Check that our attributes match our schema attributes.
+ foreach ($matchall[1] as $index => $checkattr) {
+ $sattr = $this->getServer()->getSchemaAttribute($checkattr);
+
+ # If the attribute is the same as in the XML file, then dont need to do anything.
+- if (! $sattr || ! strcasecmp($sattr->getName(),$checkattr))
++ if (! (string) $sattr || ! strcasecmp((string) $sattr->getName(),(string) $checkattr))
+ continue;
+
+- $formula = preg_replace("/$checkattr/",$sattr->getName(),$formula);
++ $formula = preg_replace("/$checkattr/",$sattr->getName(),is_null($formula)? "":$formula);
+ $matchall[1][$index] = $sattr->getName();
+ }
+
+ $elem_id = 0;
+
+ foreach ($matchall[0] as $index => $null) {
+- $match_attr = strtolower($matchall[1][$index]);
++ $match_attr = strtolower((string) $matchall[1][$index]);
+ $match_subst = $matchall[2][$index];
+ $match_mod = $matchall[3][$index];
+ $match_delim = $matchall[4][$index];
+@@ -1199,7 +1199,7 @@ class Template extends xmlTemplate {
+ $js_match_attr = $match_attr;
+ $match_attr = $js_match_attr.'xx'.$varcount[$match_attr];
+
+- $formula = preg_replace('/%'.$js_match_attr.'([|\/%])/i','%'.$match_attr.'$1',$formula,1);
++ $formula = preg_replace('/%'.$js_match_attr.'([|\/%])/i','%'.$match_attr.'$1',$formula,is_null(1)? "":1);
+
+ $attribute->js['autoFill'] .= sprintf(" var %s;\n",$match_attr);
+ $attribute->js['autoFill'] .= sprintf(
+@@ -1216,7 +1216,7 @@ class Template extends xmlTemplate {
+ $elem_id++;
+
+ if (strstr($match_mod,'k')) {
+- preg_match_all('/([0-9]+)/',trim($match_subst),$substrarray);
++ preg_match_all('/([0-9]+)/',trim((string) $match_subst),$substrarray);
+ if (isset($substrarray[1][0])) {
+ $tok_idx = $substrarray[1][0];
+ } else {
+@@ -1225,7 +1225,7 @@ class Template extends xmlTemplate {
+ $attribute->js['autoFill'] .= sprintf(" %s = %s.split(':')[%s];\n",$match_attr,$match_attr,$tok_idx);
+
+ } elseif (strstr($match_mod,'K')) {
+- preg_match_all('/([0-9]+)/',trim($match_subst),$substrarray);
++ preg_match_all('/([0-9]+)/',trim((string) $match_subst),$substrarray);
+ if (isset($substrarray[1][0])) {
+ $tok_idx = $substrarray[1][0];
+ } else {
+@@ -1240,7 +1240,7 @@ class Template extends xmlTemplate {
+ $attribute->js['autoFill'] .= sprintf(" %s = %s.split('%s')[%s];\n",$match_attr,$match_attr,$delimiter,$tok_idx);
+
+ } else {
+- preg_match_all('/([0-9]*)-([0-9]*)/',trim($match_subst),$substrarray);
++ preg_match_all('/([0-9]*)-([0-9]*)/',trim((string) $match_subst),$substrarray);
+ if ((isset($substrarray[1][0]) && $substrarray[1][0]) || (isset($substrarray[2][0]) && $substrarray[2][0])) {
+ $attribute->js['autoFill'] .= sprintf(" %s = %s.substr(%s,%s);\n",
+ $match_attr,$match_attr,
+@@ -1260,19 +1260,19 @@ class Template extends xmlTemplate {
+ }
+
+ # Matchfor only entry without modifiers.
+- $formula = preg_replace('/^%('.$match_attr.')%$/U','$1 + \'\'',$formula);
++ $formula = preg_replace('/^%('.$match_attr.')%$/U','$1 + \'\'',is_null($formula)? "":$formula);
+ # Matchfor only entry with modifiers.
+- $formula = preg_replace('/^%('.$match_attr.')(\|[0-9]*-[0-9]*)?(\/[KklTUA]+)?(?:\|(.))?%$/U','$1 + \'\'',$formula);
++ $formula = preg_replace('/^%('.$match_attr.')(\|[0-9]*-[0-9]*)?(\/[KklTUA]+)?(?:\|(.))?%$/U','$1 + \'\'',is_null($formula)? "":$formula);
+ # Matchfor begining entry.
+- $formula = preg_replace('/^%('.$match_attr.')(\|[0-9]*-[0-9]*)?(\/[KklTUA]+)?(?:\|(.))?%/U','$1 + \'',$formula);
++ $formula = preg_replace('/^%('.$match_attr.')(\|[0-9]*-[0-9]*)?(\/[KklTUA]+)?(?:\|(.))?%/U','$1 + \'',is_null($formula)? "":$formula);
+ # Matchfor ending entry.
+- $formula = preg_replace('/%('.$match_attr.')(\|[0-9]*-[0-9]*)?(\/[KklTUA]+)?(?:\|(.))?%$/U','\' + $1 ',$formula);
++ $formula = preg_replace('/%('.$match_attr.')(\|[0-9]*-[0-9]*)?(\/[KklTUA]+)?(?:\|(.))?%$/U','\' + $1 ',is_null($formula)? "":$formula);
+ # Match for entries not at begin/end.
+- $formula = preg_replace('/%('.$match_attr.')(\|[0-9]*-[0-9]*)?(\/[KklTUA]+)?(?:\|(.))?%/U','\' + $1 + \'',$formula);
++ $formula = preg_replace('/%('.$match_attr.')(\|[0-9]*-[0-9]*)?(\/[KklTUA]+)?(?:\|(.))?%/U','\' + $1 + \'',is_null($formula)? "":$formula);
+ $attribute->js['autoFill'] .= "\n";
+ }
+
+- $attribute->js['autoFill'] .= sprintf(" fillRec(pre+'%s'+suf, %s); // %s\n",strtolower($attr),$formula,$string);
++ $attribute->js['autoFill'] .= sprintf(" fillRec(pre+'%s'+suf, %s); // %s\n",strtolower((string) $attr),$formula,$string);
+ $attribute->js['autoFill'] .= "\n";
+ break;
+
+@@ -1333,7 +1333,7 @@ class Template extends xmlTemplate {
+ $this->setMinValueCount($sattr->getName(),1);
+
+ # We need to mark the attributes as show, except for the objectclass attribute.
+- if (strcasecmp('objectClass',$objectclassattr) != 0) {
++ if (strcasecmp('objectClass',(string) $objectclassattr) != 0) {
+ $attribute = $this->getAttribute($sattr->getName());
+ $attribute->show();
+ }
diff --git a/net/phpldapadmin/files/patch-lib_TemplateRender.php b/net/phpldapadmin/files/patch-lib_TemplateRender.php
new file mode 100644
--- /dev/null
+++ b/net/phpldapadmin/files/patch-lib_TemplateRender.php
@@ -0,0 +1,99 @@
+--- lib/TemplateRender.php.orig 2021-12-12 02:35:51 UTC
++++ lib/TemplateRender.php
+@@ -291,8 +291,8 @@ class TemplateRender extends PageRender {
+ $formvalues = array_change_key_case($_REQUEST['form']);
+
+ foreach ($filtermatchall[1] as $arg) {
+- $value = $formvalues[strtolower($arg)];
+- $args[1] = preg_replace("/%($arg)(\|.+)?(\/[lU])?%/U",$value,$args[1]);
++ $value = $formvalues[strtolower((string) $arg)];
++ $args[1] = preg_replace("/%($arg)(\|.+)?(\/[lU])?%/U",$value,is_null($args[1])? "":$args[1]);
+ }
+ }
+
+@@ -323,7 +323,7 @@ class TemplateRender extends PageRender {
+ $fixedvalue = preg_split('/=\>/',$fixedvalue);
+ $displayvalue = explode('=',$fixedvalue[1]);
+
+- $newvalue[trim($fixedvalue[0])] = array($args[2]=>trim($fixedvalue[0]),trim($displayvalue[0])=>trim($displayvalue[1]));
++ $newvalue[trim((string) $fixedvalue[0])] = array($args[2]=>trim((string) $fixedvalue[0]),trim((string) $displayvalue[0])=>trim((string) $displayvalue[1]));
+
+ $picklistvalues = array_merge($picklistvalues,$newvalue);
+ }
+@@ -353,7 +353,7 @@ class TemplateRender extends PageRender {
+ if (function_exists('mb_convert_case'))
+ $disp_val = mb_convert_case($disp_val,MB_CASE_LOWER,'utf-8');
+ else
+- $disp_val = strtolower($disp_val);
++ $disp_val = strtolower((string) $disp_val);
+
+ break;
+
+@@ -380,11 +380,11 @@ class TemplateRender extends PageRender {
+ }
+
+ # make value a substring of
+- preg_match_all('/^\|([0-9]*)-([0-9]*)$/',trim($matchall[2][$key]),$substrarray);
++ preg_match_all('/^\|([0-9]*)-([0-9]*)$/',trim((string) $matchall[2][$key]),$substrarray);
+
+ if ((isset($substrarray[1][0]) && $substrarray[1][0]) || (isset($substrarray[2][0]) && $substrarray[2][0])) {
+ $begin = $substrarray[1][0] ? $substrarray[1][0] : '0';
+- $end = $substrarray[2][0] ? $substrarray[2][0] : strlen($disp_val);
++ $end = $substrarray[2][0] ? $substrarray[2][0] : strlen((string) $disp_val);
+
+ if (function_exists('mb_substr'))
+ $disp_val = mb_substr($disp_val,$begin,$end,'utf-8');
+@@ -392,7 +392,7 @@ class TemplateRender extends PageRender {
+ $disp_val = substr($disp_val,$begin,$end);
+ }
+
+- $display = preg_replace("/%($arg)(\|.+)?(\/[lUC])?%/U",$disp_val,$display);
++ $display = preg_replace("/%($arg)(\|.+)?(\/[lUC])?%/U",$disp_val,is_null($display)? "":$display);
+ }
+
+ if (! isset($picklist[$values[$args[2]]])) {
+@@ -1347,7 +1347,7 @@ class TemplateRender extends PageRender {
+ echo ' | |