Page MenuHomeFreeBSD

D37513.diff
No OneTemporary

D37513.diff

diff --git a/net/phpldapadmin/Makefile b/net/phpldapadmin/Makefile
--- 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
--- /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
--- /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
--- /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 '<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
--- /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
--- /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 <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
--- /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
--- /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<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
--- 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('<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
--- 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
--- /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('<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
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 '<td><select name="new_values[objectclass][]" multiple="multiple" size="15">';
+
+ foreach ($socs as $name => $oclass) {
+- if (! strcasecmp('top',$name))
++ if (! strcasecmp('top',(string) $name))
+ continue;
+
+ printf('<option %s value="%s">%s</option>',
+@@ -1879,7 +1879,7 @@ function fillRec(id,value) {
+ protected function drawDnValueIconAttribute($attribute,$val) {
+ if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
+
+- if (strlen($val) <= 0)
++ if (strlen((string) $val) <= 0)
+ printf('<img src="%s/ldap-alias.png" alt="Go" style="float: right;" />&nbsp;',IMGDIR);
+ elseif ($this->getServer()->dnExists($val))
+ printf('<a href="cmd.php?cmd=template_engine&amp;server_id=%s&amp;dn=%s" title="%s %s"><img src="%s/ldap-alias.png" alt="Go" /></a>&nbsp;',
+@@ -1892,7 +1892,7 @@ function fillRec(id,value) {
+ if (DEBUGTMP) printf('<font size=-2>%s</font><br />',__METHOD__);
+
+ $img = sprintf('<img src="%s/mail.png" alt="%s" style="float: right;" />',IMGDIR,_('Mail'));
+- if (strlen($val) <= 0)
++ if (strlen((string) $val) <= 0)
+ echo $img;
+ else
+ printf('<a href="mailto:%s">%s</a>',htmlspecialchars($val),$img);
+@@ -1905,7 +1905,7 @@ function fillRec(id,value) {
+ $img = sprintf('<img src="%s/ldap-dc.png" alt="%s" style="float: right;" />',IMGDIR,_('URL'));
+ $url = explode(' +',$val,2);
+
+- if (strlen($val) <= 0)
++ if (strlen((string) $val) <= 0)
+ echo $img;
+ else
+ printf('<a href="%s" onclick="target=\'new\';">%s</a>',htmlspecialchars($url[0]),$img);
+@@ -2387,7 +2387,7 @@ function deleteAttribute(attrName,friendlyName,i)
+ if (! $_SESSION[APPCONFIG]->getValue('appearance','show_schema_link') || !$_SESSION[APPCONFIG]->isCommandAvailable('script','schema'))
+ return;
+
+- if (strlen($val) > 0) {
++ if (strlen((string) $val) > 0) {
+ $href = sprintf('cmd.php?cmd=schema&server_id=%s&view=objectclasses&viewvalue=%s',
+ $this->getServerID(),$val);
+ printf('<a href="%s" title="%s"><img src="%s/info.png" alt="Info" /></a>&nbsp;',
diff --git a/net/phpldapadmin/files/patch-lib_Tree.php b/net/phpldapadmin/files/patch-lib_Tree.php
--- a/net/phpldapadmin/files/patch-lib_Tree.php
+++ b/net/phpldapadmin/files/patch-lib_Tree.php
@@ -1,11 +1,20 @@
--- lib/Tree.php.orig 2021-12-12 02:35:51 UTC
+++ lib/Tree.php
-@@ -68,7 +68,7 @@ abstract class Tree {
- }
- }
+@@ -132,7 +132,7 @@ abstract class Tree {
+ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
+ debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs);
-- set_cached_item($server_id,'tree','null',$tree);
-+ set_cached_item($server_id,$tree,'tree','null');
- }
+- $index = strtolower(implode(',',pla_explode_dn($dn)));
++ $index = strtolower((string) implode(',',pla_explode_dn($dn)));
- return $tree;
+ if (DEBUG_ENABLED)
+ debug_log('Result (%s)',1,0,__FILE__,__LINE__,__METHOD__,$index);
+@@ -185,7 +185,7 @@ abstract class Tree {
+ $tree_factory = new TreeItem($server->getIndex(),$dn);
+ $tree_factory->setObjectClasses($server->getDNAttrValue($dn,'objectClass'));
+
+- if ((($isleaf = $server->getDNAttrValue($dn,'hassubordinates')) && ! strcasecmp($isleaf[0],'false')))
++ if ((($isleaf = $server->getDNAttrValue($dn,'hassubordinates')) && ! strcasecmp((string) $isleaf[0],'false')))
+ $tree_factory->setLeaf();
+
+ $this->entries[$dnlower] = $tree_factory;
diff --git a/net/phpldapadmin/files/patch-lib_TreeItem.php b/net/phpldapadmin/files/patch-lib_TreeItem.php
new file mode 100644
--- /dev/null
+++ b/net/phpldapadmin/files/patch-lib_TreeItem.php
@@ -0,0 +1,11 @@
+--- lib/TreeItem.php.orig 2021-12-12 02:35:51 UTC
++++ lib/TreeItem.php
+@@ -59,7 +59,7 @@ class TreeItem {
+ }
+
+ public function getDNEncode() {
+- 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));
+ }
+
+ /**
diff --git a/net/phpldapadmin/files/patch-lib_common.php b/net/phpldapadmin/files/patch-lib_common.php
--- a/net/phpldapadmin/files/patch-lib_common.php
+++ b/net/phpldapadmin/files/patch-lib_common.php
@@ -1,13 +1,14 @@
--- lib/common.php.orig 2021-12-12 02:35:51 UTC
+++ lib/common.php
-@@ -296,7 +296,9 @@ if ($app['language'] == 'auto') {
- * Strip slashes from GET, POST, and COOKIE variables if this
- * PHP install is configured to automatically addslashes()
- */
--if (@get_magic_quotes_gpc() && (! isset($slashes_stripped) || ! $slashes_stripped)) {
-+if (@version_compare(phpversion(), '5.4.0', '<') &&
-+ @get_magic_quotes_gpc() &&
-+ (!isset($slashes_stripped) || !$slashes_stripped)) {
- array_stripslashes($_REQUEST);
- array_stripslashes($_GET);
- array_stripslashes($_POST);
+@@ -247,9 +247,9 @@ if ($app['language'] == 'auto') {
+
+ $value = preg_split('/[-]+/',$value);
+ if (sizeof($value) == 2)
+- $app['lang_http'][$key] = strtolower($value[0]).'_'.strtoupper($value[1]);
++ $app['lang_http'][$key] = strtolower((string) $value[0]).'_'.strtoupper($value[1]);
+ else
+- $app['lang_http'][$key] = auto_lang(strtolower($value[0]));
++ $app['lang_http'][$key] = auto_lang(strtolower((string) $value[0]));
+ }
+
+ $app['lang_http'] = array_unique($app['lang_http']);
diff --git a/net/phpldapadmin/files/patch-lib_ds.php b/net/phpldapadmin/files/patch-lib_ds.php
new file mode 100644
--- /dev/null
+++ b/net/phpldapadmin/files/patch-lib_ds.php
@@ -0,0 +1,29 @@
+--- lib/ds.php.orig 2021-12-12 02:35:51 UTC
++++ lib/ds.php
+@@ -371,7 +371,7 @@ abstract class DS {
+ $replacement = $this->getValue('login', 'sasl_dn_replacement');
+
+ if ($regex && $replacement) {
+- $userDN = preg_replace($regex, $replacement, $_SERVER['REMOTE_USER']);
++ $userDN = preg_replace($regex, $replacement,is_null( $_SERVER['REMOTE_USER'])? "": $_SERVER['REMOTE_USER']);
+
+ $CACHE[$this->index][$method] = $this->login($userDN, '', $method);
+
+@@ -437,7 +437,7 @@ abstract class DS {
+ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
+ debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
+
+- if (! trim($this->getLogin(null)) && $_SESSION[APPCONFIG]->getValue('appearance','anonymous_bind_implies_read_only'))
++ if (! trim((string) $this->getLogin(null)) && $_SESSION[APPCONFIG]->getValue('appearance','anonymous_bind_implies_read_only'))
+ return true;
+ else
+ return $this->getValue('server','read_only');
+@@ -691,7 +691,7 @@ class Datastore {
+ debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
+
+ # If no index defined, then pick the lowest one.
+- if (is_null($index) || ! trim($index) || ! is_numeric($index))
++ if (is_null($index) || ! trim((string) $index) || ! is_numeric($index))
+ $index = min($this->GetServerList())->getIndex();
+
+ if (! isset($this->objects[$index]))
diff --git a/net/phpldapadmin/files/patch-lib_ds__ldap.php b/net/phpldapadmin/files/patch-lib_ds__ldap.php
--- a/net/phpldapadmin/files/patch-lib_ds__ldap.php
+++ b/net/phpldapadmin/files/patch-lib_ds__ldap.php
@@ -1,38 +1,459 @@
--- lib/ds_ldap.php.orig 2021-12-12 02:35:51 UTC
+++ lib/ds_ldap.php
-@@ -1768,7 +1768,7 @@ class ldap extends DS {
- ksort($return);
+@@ -206,6 +206,7 @@ class ldap extends DS {
+
+ if ($this->getValue('server','port'))
+ $resource = ldap_connect($this->getValue('server','host'),$this->getValue('server','port'));
++
+ else
+ $resource = ldap_connect($this->getValue('server','host'));
+
+@@ -216,7 +217,8 @@ class ldap extends DS {
+ debug_log('LDAP Resource [%s], Host [%s], Port [%s]',16,0,__FILE__,__LINE__,__METHOD__,
+ $resource,$this->getValue('server','host'),$this->getValue('server','port'));
- # cache the schema to prevent multiple schema fetches from LDAP server
-- set_cached_item($this->index,'schema','objectclasses',$return);
-+ set_cached_item($this->index,$return,'schema','objectclasses');
+- if (! is_resource($resource))
++ // if (! is_resource($resource))
++ if ( !$resource )
+ debug_dump_backtrace('UNHANDLED, $resource is not a resource',1);
+
+ # Go with LDAP version 3 if possible (needed for renaming and Novell schema fetching)
+@@ -328,7 +330,7 @@ class ldap extends DS {
+ }
}
- if (DEBUG_ENABLED)
-@@ -1953,7 +1953,7 @@ class ldap extends DS {
- $return = $attrs;
+- if (! $this->isAnonBindAllowed() && ! trim($userDN))
++ if (! $this->isAnonBindAllowed() && ! trim((string) $userDN))
+ return false;
+
+ # Temporarily set our user details
+@@ -337,7 +339,7 @@ class ldap extends DS {
+ $connect = $this->connect($method,false,$new);
+
+ # If we didnt log in...
+- if (! is_resource($connect) || $this->noconnect || ! $this->userIsAllowedLogin($userDN)) {
++ if (!$connect || $this->noconnect || ! $this->userIsAllowedLogin($userDN)) {
+ $this->logout($method);
+
+ return false;
+@@ -565,11 +567,11 @@ class ldap extends DS {
+
+ private function fillDNTemplate($user) {
+ foreach($this->getLoginBaseDN() as $base)
+- if(substr_compare($user, $base, -strlen($base)) === 0)
++ if(substr_compare($user, $base, -strlen((string) $base)) === 0)
+ return $user; // $user already passed as DN
+
+ // fill template
+- return sprintf($this->getValue('login', 'bind_dn_template'), preg_replace('/([,\\\\#+<>;"=])/', '\\\\$1', $user));
++ return sprintf($this->getValue('login', 'bind_dn_template'), preg_replace('/([,\\\\#+<>;"=])/', '\\\\$1',is_null( $user)? "": $user));
+ }
- # cache the schema to prevent multiple schema fetches from LDAP server
-- set_cached_item($this->index,'schema','attributes',$return);
-+ set_cached_item($this->index,$return,'schema','attributes');
+ /**
+@@ -684,7 +686,7 @@ class ldap extends DS {
+
+ if (! in_array($this->getValue('login','auth_type'), array('sasl','sasl_external'))) {
+ // check if SASL mech uses login from other auth_types
+- if (! in_array(strtolower($this->getValue('sasl', 'mech')), array('plain')))
++ if (! in_array(strtolower((string) $this->getValue('sasl', 'mech')), array('plain')))
+ return false;
}
- if (DEBUG_ENABLED)
-@@ -2029,7 +2029,7 @@ class ldap extends DS {
- $return = $rules;
+@@ -722,7 +724,7 @@ class ldap extends DS {
+ }
- # cache the schema to prevent multiple schema fetches from LDAP server
-- set_cached_item($this->index,'schema','matchingrules',$return);
-+ set_cached_item($this->index,$return,'schema','matchingrules');
+ # At the moment, we have only implemented GSSAPI and PLAIN
+- if (! in_array(strtolower($this->getValue('sasl','mech')),array('gssapi','plain'))) {
++ if (! in_array(strtolower((string) $this->getValue('sasl','mech')),array('gssapi','plain'))) {
+ system_message(array(
+ 'title'=>_('SASL Method not implemented'),
+ 'body'=>sprintf('<b>%s</b>: %s %s',_('Error'),$this->getValue('sasl','mech'),_('has not been implemented yet')),
+@@ -731,7 +733,7 @@ class ldap extends DS {
+ return false;
}
+- if (strtolower($this->getValue('sasl','mech')) == 'plain') {
++ if (strtolower((string) $this->getValue('sasl','mech')) == 'plain') {
+ return @ldap_sasl_bind($resource,NULL,$pass,'PLAIN',
+ $this->getValue('sasl','realm'),
+ $login,
+@@ -746,14 +748,15 @@ class ldap extends DS {
+ /*
+ # Do we need to rewrite authz_id?
+ if (! isset($CACHE['authz_id']))
+- if (! trim($this->getValue('sasl','authz_id')) && strtolower($this->getValue('sasl','mech')) != 'gssapi') {
++ if (! trim((string) $this->getValue('sasl','authz_id')) && strtolower((string) $this->getValue('sasl','mech')) != 'gssapi') {
+ if (DEBUG_ENABLED)
+ debug_log('Rewriting bind DN [%s] -> authz_id with regex [%s] and replacement [%s].',9,0,__FILE__,__LINE__,__METHOD__,
+ $CACHE['login_dn'],
+ $this->getValue('sasl','authz_id_regex'),
+ $this->getValue('sasl','authz_id_replacement'));
+
+- $CACHE['authz_id'] = @preg_replace($this->getValue('sasl','authz_id_regex'),
++ $CACHE['authz_id'] = @preg_replace($this->getValue('sasl','authz_id_regex'),is_null(
++)? "":
+ $this->getValue('sasl','authz_id_replacement'),$CACHE['login_dn']);
+
+ # Invalid regex?
+@@ -1212,14 +1215,14 @@ class ldap extends DS {
+ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
+ debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
+
+- if (! trim($dn))
++ if (! trim((string) $dn))
+ return $dn;
+
+ # Check if the RDN has a comma and escape it.
+ while (preg_match('/([^\\\\]),(\s*[^=]*\s*),/',$dn))
+- $dn = preg_replace('/([^\\\\]),(\s*[^=]*\s*),/','$1\\\\2C$2,',$dn);
++ $dn = preg_replace('/([^\\\\]),(\s*[^=]*\s*),/','$1\\\\2C$2,',is_null($dn)? "":$dn);
+
+- $dn = preg_replace('/([^\\\\]),(\s*[^=]*\s*)([^,])$/','$1\\\\2C$2$3',$dn);
++ $dn = preg_replace('/([^\\\\]),(\s*[^=]*\s*)([^,])$/','$1\\\\2C$2$3',is_null($dn)? "":$dn);
+
if (DEBUG_ENABLED)
-@@ -2078,7 +2078,7 @@ class ldap extends DS {
+ debug_log('Returning (%s)',17,0,__FILE__,__LINE__,__METHOD__,$dn);
+@@ -1237,12 +1240,12 @@ class ldap extends DS {
+ if (is_array($dn)) {
+ $a = array();
+ foreach ($dn as $key => $rdn) {
+- $a[$key] = preg_replace_callback('/\\\([0-9A-Fa-f]{2})/', function($m) { return chr(hexdec($m[1])); }, $rdn);
++ $a[$key] = preg_replace_callback('/\\\([0-9A-Fa-f]{2})/', function($m) { return chr(hexdec($m[1])); },is_null( $rdn)? "": $rdn);
+ }
+ return $a;
+
+ } else {
+- return preg_replace_callback('/\\\([0-9A-Fa-f]{2})/', function($m) { return chr(hexdec($m[1])); }, $dn);
++ return preg_replace_callback('/\\\([0-9A-Fa-f]{2})/', function($m) { return chr(hexdec($m[1])); },is_null( $dn)? "": $dn);
+ }
+ }
+
+@@ -1388,7 +1391,7 @@ class ldap extends DS {
+ return false;
+
+ # error checking
+- $schema_to_fetch = strtolower($schema_to_fetch);
++ $schema_to_fetch = strtolower((string) $schema_to_fetch);
+
+ if (! is_null($this->_schema_entries) && isset($this->_schema_entries[$schema_to_fetch])) {
+ $schema = $this->_schema_entries[$schema_to_fetch];
+@@ -1408,7 +1411,7 @@ class ldap extends DS {
+ $schema_dn = $this->getSchemaDN($method,$dn);
+
+ # Do we need to try again with the Root DSE?
+- if (! $schema_dn && trim($dn))
++ if (! $schema_dn && trim((string) $dn))
+ $schema_dn = $this->getSchemaDN($method,'');
+
+ # Store the eventual schema retrieval in $schema_search
+@@ -1609,7 +1612,7 @@ class ldap extends DS {
+ foreach ($entry[$olc_schema] as $schema_definition)
+ /* Schema definitions in child nodes prefix the schema entries with "{n}"
+ the preg_replace call strips out this prefix. */
+- $schema[] = preg_replace('/^\{\d*\}\(/','(',$schema_definition);
++ $schema[] = preg_replace('/^\{\d*\}\(/','(',is_null($schema_definition)? "":$schema_definition);
+ }
+ }
+
+@@ -1672,7 +1675,7 @@ class ldap extends DS {
+ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
+ debug_log('Entered (%%)',25,0,__FILE__,__LINE__,__METHOD__,$fargs);
+
+- $oclass_name = strtolower($oclass_name);
++ $oclass_name = strtolower((string) $oclass_name);
+ $socs = $this->SchemaObjectClasses($method,$dn);
+
+ # Default return value
+@@ -1703,7 +1706,7 @@ class ldap extends DS {
+ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
+ debug_log('Entered (%%)',25,0,__FILE__,__LINE__,__METHOD__,$fargs);
+
+- $attr_name = strtolower($attr_name);
++ $attr_name = strtolower((string) $attr_name);
+ $sattrs = $this->SchemaAttributes($method,$dn);
+
+ # Default return value
+@@ -1752,7 +1755,7 @@ class ldap extends DS {
+ $return = array();
+
+ foreach ($raw as $line) {
+- if (is_null($line) || ! strlen($line))
++ if (is_null($line) || ! strlen((string) $line))
+ continue;
+
+ $object_class = new ObjectClass($line,$this);
+@@ -1762,8 +1765,8 @@ class ldap extends DS {
+ # Now go through and reference the parent/child relationships
+ foreach ($return as $oclass)
+ foreach ($oclass->getSupClasses() as $parent_name)
+- if (isset($return[strtolower($parent_name)]))
+- $return[strtolower($parent_name)]->addChildObjectClass($oclass->getName(false));
++ if (isset($return[strtolower((string) $parent_name)]))
++ $return[strtolower((string) $parent_name)]->addChildObjectClass($oclass->getName(false));
+
ksort($return);
- # cache the schema to prevent multiple schema fetches from LDAP server
-- set_cached_item($this->index,'schema','syntaxes',$return);
-+ set_cached_item($this->index,$return,'schema','syntaxes');
+@@ -1816,7 +1819,7 @@ class ldap extends DS {
+ */
+ $attrs_oid = array();
+ foreach ($raw as $line) {
+- if (is_null($line) || ! strlen($line))
++ if (is_null($line) || ! strlen((string) $line))
+ continue;
+
+ $attr = new AttributeType($line);
+@@ -1847,7 +1850,7 @@ class ldap extends DS {
+ $new_attr->setName($alias_attr_name);
+ $new_attr->addAlias($attr->getName(false));
+ $new_attr->removeAlias($alias_attr_name);
+- $new_attr_key = strtolower($alias_attr_name);
++ $new_attr_key = strtolower((string) $alias_attr_name);
+ $attrs[$new_attr_key] = $new_attr;
+ }
+ }
+@@ -1858,7 +1861,7 @@ class ldap extends DS {
+ $sup_attr_name = $attr->getSupAttribute();
+ $sup_attr = null;
+
+- if (trim($sup_attr_name)) {
++ if (trim((string) $sup_attr_name)) {
+
+ /* This loop really should traverse infinite levels of inheritance (SUP) for attributeTypes,
+ * but just in case we get carried away, stop at 100. This shouldn't happen, but for
+@@ -1871,17 +1874,17 @@ class ldap extends DS {
+ $sup_attr_name = $attr->getSupAttribute();
+ }
+
+- if (! isset($attrs[strtolower($sup_attr_name)])){
++ if (! isset($attrs[strtolower((string) $sup_attr_name)])){
+ error(sprintf('Schema error: attributeType "%s" inherits from "%s", but attributeType "%s" does not exist.',
+ $attr->getName(),$sup_attr_name,$sup_attr_name),'error','index.php');
+ return;
+ }
+
+- $sup_attr = $attrs[strtolower($sup_attr_name)];
++ $sup_attr = $attrs[strtolower((string) $sup_attr_name)];
+ $sup_attr_name = $sup_attr->getSupAttribute();
+
+ # Does this superior attributeType not have a superior attributeType?
+- if (is_null($sup_attr_name) || strlen(trim($sup_attr_name)) == 0) {
++ if (is_null($sup_attr_name) || strlen((string) trim((string) $sup_attr_name)) == 0) {
+
+ /* Since this attribute's superior attribute does not have another superior
+ * attribute, clone its properties for this attribute. Then, replace
+@@ -1936,18 +1939,18 @@ class ldap extends DS {
+
+ # Add Used In.
+ foreach ($oclass_attrs as $attr_name)
+- if (isset($attrs[strtolower($attr_name)]))
+- $attrs[strtolower($attr_name)]->addUsedInObjectClass($object_class->getName(false));
++ if (isset($attrs[strtolower((string) $attr_name)]))
++ $attrs[strtolower((string) $attr_name)]->addUsedInObjectClass($object_class->getName(false));
+
+ # Add Required By.
+ foreach ($must_attrs as $attr_name)
+- if (isset($attrs[strtolower($attr_name)]))
+- $attrs[strtolower($attr_name)]->addRequiredByObjectClass($object_class->getName(false));
++ if (isset($attrs[strtolower((string) $attr_name)]))
++ $attrs[strtolower((string) $attr_name)]->addRequiredByObjectClass($object_class->getName(false));
+
+ # Force May
+ foreach ($object_class->getForceMayAttrs() as $attr_name)
+- if (isset($attrs[strtolower($attr_name->name)]))
+- $attrs[strtolower($attr_name->name)]->setForceMay();
++ if (isset($attrs[strtolower((string) $attr_name->name)]))
++ $attrs[strtolower((string) $attr_name->name)]->setForceMay();
+ }
+
+ $return = $attrs;
+@@ -1987,7 +1990,7 @@ class ldap extends DS {
+ $rules = array();
+
+ foreach ($raw as $line) {
+- if (is_null($line) || ! strlen($line))
++ if (is_null($line) || ! strlen((string) $line))
+ continue;
+
+ $rule = new MatchingRule($line);
+@@ -2003,7 +2006,7 @@ class ldap extends DS {
+
+ if ($raw != false) {
+ foreach ($raw as $line) {
+- if (is_null($line) || ! strlen($line))
++ if (is_null($line) || ! strlen((string) $line))
+ continue;
+
+ $rule_use = new MatchingRuleUse($line);
+@@ -2019,7 +2022,7 @@ class ldap extends DS {
+ $sattrs = $this->SchemaAttributes($method,$dn);
+ if (is_array($sattrs))
+ foreach ($sattrs as $attr) {
+- $rule_key = strtolower($attr->getEquality());
++ $rule_key = strtolower((string) $attr->getEquality());
+
+ if (isset($rules[$rule_key]))
+ $rules[$rule_key]->addUsedByAttr($attr->getName(false));
+@@ -2063,11 +2066,11 @@ class ldap extends DS {
+ $return = array();
+
+ foreach ($raw as $line) {
+- if (is_null($line) || ! strlen($line))
++ if (is_null($line) || ! strlen((string) $line))
+ continue;
+
+ $syntax = new Syntax($line);
+- $key = strtolower(trim($syntax->getOID()));
++ $key = strtolower((string) trim((string) $syntax->getOID()));
+
+ if (! $key)
+ continue;
+@@ -2097,7 +2100,7 @@ class ldap extends DS {
+ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
+ debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
+
+- return in_array($attr_name,unserialize(strtolower(serialize($this->getValue('server','force_may')))));
++ return in_array($attr_name,unserialize(strtolower((string) serialize($this->getValue('server','force_may')))));
+ }
+
+ /**
+@@ -2133,7 +2136,7 @@ class ldap extends DS {
+ debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
+
+ # Ensure our attr is in lowercase
+- $attr = strtolower($attr);
++ $attr = strtolower((string) $attr);
+
+ $values = $this->getDNAttrValues($dn,$method,$deref);
+
+@@ -2247,7 +2250,7 @@ class ldap extends DS {
+ # Simple test first
+ $dn_attrs = array('aliasedObjectName');
+ foreach ($dn_attrs as $dn_attr)
+- if (strcasecmp($attr_name,$dn_attr) == 0)
++ if (strcasecmp((string) $attr_name,(string) $dn_attr) == 0)
+ return true;
+
+ # Now look at the schema OID
+@@ -2266,7 +2269,7 @@ class ldap extends DS {
+ return false;
+
+ $syntax_desc = $syntaxes[ $syntax_oid ]->getDescription();
+- if (strpos(strtolower($syntax_desc),'distinguished name'))
++ if (strpos(strtolower((string) $syntax_desc),'distinguished name'))
+ return true;
+
+ return false;
+@@ -2286,7 +2289,7 @@ class ldap extends DS {
+ debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
+
+ # easy quick check
+- if (! strcasecmp($attr_name,'jpegPhoto') || ! strcasecmp($attr_name,'photo'))
++ if (! strcasecmp((string) $attr_name,'jpegPhoto') || ! strcasecmp((string) $attr_name,'photo'))
+ return true;
+
+ # go to the schema and get the Syntax OID
+@@ -2297,7 +2300,7 @@ class ldap extends DS {
+ $oid = $sattr->getSyntaxOID();
+ $type = $sattr->getType();
+
+- if (! strcasecmp($type,'JPEG') || ($oid == '1.3.6.1.4.1.1466.115.121.1.28'))
++ if (! strcasecmp((string) $type,'JPEG') || ((string) $oid == '1.3.6.1.4.1.1466.115.121.1.28'))
+ return true;
+
+ return false;
+@@ -2318,9 +2321,9 @@ class ldap extends DS {
+
+ $type = ($sattr = $this->getSchemaAttribute($attr_name)) ? $sattr->getType() : null;
+
+- if (! strcasecmp('boolean',$type) ||
+- ! strcasecmp('isCriticalSystemObject',$attr_name) ||
+- ! strcasecmp('showInAdvancedViewOnly',$attr_name))
++ if (! strcasecmp('boolean',(string) $type) ||
++ ! strcasecmp('isCriticalSystemObject',(string) $attr_name) ||
++ ! strcasecmp('showInAdvancedViewOnly',(string) $attr_name))
+ return true;
+
+ else
+@@ -2359,7 +2362,7 @@ class ldap extends DS {
+
+ static $attr_cache;
+
+- $attr_name = strtolower($attr_name);
++ $attr_name = strtolower((string) $attr_name);
+
+ if (isset($attr_cache[$this->index][$attr_name]))
+ return $attr_cache[$this->index][$attr_name];
+@@ -2370,7 +2373,7 @@ class ldap extends DS {
}
- if (DEBUG_ENABLED)
+ # Quick check: If the attr name ends in ";binary", then it's binary.
+- if (strcasecmp(substr($attr_name,strlen($attr_name) - 7),';binary') == 0) {
++ if (strcasecmp(substr((string) $attr_name,strlen((string) (string) $attr_name) - 7),';binary') == 0) {
+ $attr_cache[$this->index][$attr_name] = true;
+ return true;
+ }
+@@ -2389,17 +2392,17 @@ class ldap extends DS {
+ $syntax = $sattr->getSyntaxOID();
+ }
+
+- if (strcasecmp($type,'Certificate') == 0 ||
+- strcasecmp($type,'Binary') == 0 ||
+- strcasecmp($attr_name,'usercertificate') == 0 ||
+- strcasecmp($attr_name,'usersmimecertificate') == 0 ||
+- strcasecmp($attr_name,'networkaddress') == 0 ||
+- strcasecmp($attr_name,'objectGUID') == 0 ||
+- strcasecmp($attr_name,'objectSID') == 0 ||
+- strcasecmp($attr_name,'auditingPolicy') == 0 ||
+- strcasecmp($attr_name,'jpegPhoto') == 0 ||
+- strcasecmp($attr_name,'krbExtraData') == 0 ||
+- strcasecmp($attr_name,'krbPrincipalKey') == 0 ||
++ if (strcasecmp((string) $type,'Certificate') == 0 ||
++ strcasecmp((string) $type,'Binary') == 0 ||
++ strcasecmp((string) $attr_name,'usercertificate') == 0 ||
++ strcasecmp((string) $attr_name,'usersmimecertificate') == 0 ||
++ strcasecmp((string) $attr_name,'networkaddress') == 0 ||
++ strcasecmp((string) $attr_name,'objectGUID') == 0 ||
++ strcasecmp((string) $attr_name,'objectSID') == 0 ||
++ strcasecmp((string) $attr_name,'auditingPolicy') == 0 ||
++ strcasecmp((string) $attr_name,'jpegPhoto') == 0 ||
++ strcasecmp((string) $attr_name,'krbExtraData') == 0 ||
++ strcasecmp((string) $attr_name,'krbPrincipalKey') == 0 ||
+ $syntax == '1.3.6.1.4.1.1466.115.121.1.10' ||
+ $syntax == '1.3.6.1.4.1.1466.115.121.1.28' ||
+ $syntax == '1.3.6.1.4.1.1466.115.121.1.5' ||
+@@ -2428,7 +2431,7 @@ class ldap extends DS {
+ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
+ debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
+
+- $user = strtolower($user);
++ $user = strtolower((string) $user);
+ $group = $this->getDNAttrValues($group);
+
+ # If you are using groupOfNames objectClass
+@@ -2459,7 +2462,7 @@ class ldap extends DS {
+ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
+ debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
+
+- $dn = trim(strtolower($dn));
++ $dn = trim((string) strtolower((string) $dn));
+
+ if (! $this->getValue('login','allowed_dns'))
+ return true;
+@@ -2498,7 +2501,7 @@ class ldap extends DS {
+ debug_log('Comparing with [%s]',80,0,__FILE__,__LINE__,__METHOD__,$result_dn);
+
+ # Check if $result_dn is a user DN
+- if (strcasecmp($dn,trim(strtolower($result_dn))) == 0)
++ if (strcasecmp((string) $dn,trim((string) strtolower((string) (string) $result_dn))) == 0)
+ return true;
+
+ # Check if $result_dn is a group DN
+@@ -2510,7 +2513,7 @@ class ldap extends DS {
+ }
+
+ # Check if $login_allowed_dn is a user DN
+- if (strcasecmp($dn,trim(strtolower($login_allowed_dn))) == 0)
++ if (strcasecmp((string) $dn,trim((string) strtolower((string) (string) $login_allowed_dn))) == 0)
+ return true;
+
+ # Check if $login_allowed_dn is a group DN
diff --git a/net/phpldapadmin/files/patch-lib_ds__ldap__pla.php b/net/phpldapadmin/files/patch-lib_ds__ldap__pla.php
--- a/net/phpldapadmin/files/patch-lib_ds__ldap__pla.php
+++ b/net/phpldapadmin/files/patch-lib_ds__ldap__pla.php
@@ -1,29 +1,40 @@
--- lib/ds_ldap_pla.php.orig 2021-12-12 02:35:51 UTC
+++ lib/ds_ldap_pla.php
-@@ -371,7 +371,7 @@ class ldap_pla extends ldap {
-
- $tree->addEntry($dn);
-
-- set_cached_item($this->index,'tree','null',$tree);
-+ set_cached_item($this->index,$tree,'tree','null');
-
- run_hook('post_entry_create',array('server_id'=>$this->index,'method'=>$method,'dn'=>$dn,'attrs'=>$entry_array));
-
-@@ -403,7 +403,7 @@ class ldap_pla extends ldap {
- $tree = get_cached_item($this->index,'tree');
- $tree->delEntry($dn);
-
-- set_cached_item($this->index,'tree','null',$tree);
-+ set_cached_item($this->index,$tree,'tree','null');
-
- run_hook('post_entry_delete',array('server_id'=>$this->index,'method'=>$method,'dn'=>$dn));
- }
-@@ -430,7 +430,7 @@ class ldap_pla extends ldap {
- $newdn = sprintf('%s,%s',$new_rdn,$container);
- $tree->renameEntry($dn,$newdn);
-
-- set_cached_item($this->index,'tree','null',$tree);
-+ set_cached_item($this->index,$tree,'tree','null');
-
- run_hook('post_entry_rename',array('server_id'=>$this->index,'method'=>$method,'dn'=>$dn,'rdn'=>$new_rdn,'container'=>$container));
- }
+@@ -248,7 +248,7 @@ class ldap_pla extends ldap {
+ # Next, compare strictly by name first
+ else
+ foreach ($_SESSION[APPCONFIG]->getValue('appearance','multi_line_attributes') as $multi_line_attr_name)
+- if (strcasecmp($multi_line_attr_name,$attr_name) == 0) {
++ if (strcasecmp((string) $multi_line_attr_name,(string) $attr_name) == 0) {
+ $return = true;
+ break;
+ }
+@@ -285,8 +285,8 @@ class ldap_pla extends ldap {
+ * @return boolean
+ */
+ private function isAttrTest($attr,$attrs,$except_dn) {
+- $attr = trim($attr);
+- if (! trim($attr) || ! count($attrs))
++ $attr = trim((string) $attr);
++ if (! trim((string) $attr) || ! count($attrs))
+ return false;
+
+ # Is the user excluded?
+@@ -294,7 +294,7 @@ class ldap_pla extends ldap {
+ return false;
+
+ foreach ($attrs as $attr_name)
+- if (strcasecmp($attr,trim($attr_name)) == 0)
++ if (strcasecmp((string) $attr,trim((string) (string) $attr_name)) == 0)
+ return true;
+
+ return false;
+@@ -674,7 +674,7 @@ class ldap_pla extends ldap {
+ if ($this->getValue('appearance', 'show_authz') && function_exists('ldap_exop_whoami')) {
+ $result = @ldap_exop_whoami($this->connect($method));
+ if ($result) // strip any dn: or u: prefix
+- $result = preg_replace('/^(u|dn):/i', '', $result);
++ $result = preg_replace('/^(u|dn):/i', '',is_null( $result)? "": $result);
+ else // fall back to login on error
+ $result = $this->getLogin($method);
+ return $result;
diff --git a/net/phpldapadmin/files/patch-lib_export__functions.php b/net/phpldapadmin/files/patch-lib_export__functions.php
new file mode 100644
--- /dev/null
+++ b/net/phpldapadmin/files/patch-lib_export__functions.php
@@ -0,0 +1,46 @@
+--- lib/export_functions.php.orig 2021-12-12 02:35:51 UTC
++++ lib/export_functions.php
+@@ -131,7 +131,7 @@ abstract class Export {
+ $query['size_limit'] = 0;
+ $attrs = get_request('attributes','REQUEST');
+
+- $attrs = preg_replace('/\s+/','',$attrs);
++ $attrs = preg_replace('/\s+/','',is_null($attrs)? "":$attrs);
+ if ($attrs)
+ $query['attrs'] = explode(',',$attrs);
+ else
+@@ -222,7 +222,7 @@ abstract class Export {
+ * @return boolean true if the string is safe ascii, false otherwise.
+ */
+ protected function isSafeAscii($str) {
+- for ($i=0;$i<strlen($str);$i++)
++ for ($i=0;$i<strlen((string) $str);$i++)
+ if (ord($str[$i]) < 32 || ord($str[$i]) > 127)
+ return false;
+
+@@ -478,7 +478,7 @@ class ExportLDIF extends Export {
+
+ $title_string = sprintf('# %s %s: %s%s',_('Entry'),$counter,$dn,$this->br);
+
+- if (strlen($title_string) > $this->line_length-3)
++ if (strlen((string) $title_string) > $this->line_length-3)
+ $title_string = substr($title_string,0,$this->line_length-3).'...'.$this->br;
+
+ $output .= $title_string;
+@@ -517,14 +517,14 @@ class ExportLDIF extends Export {
+ * @param The line to be wrapped if needed.
+ */
+ private function multiLineDisplay($str) {
+- $length_string = strlen($str);
++ $length_string = strlen((string) $str);
+ $length_max = $this->line_length;
+
+ $output = '';
+ while ($length_string > $length_max) {
+ $output .= substr($str,0,$length_max).$this->br.' ';
+ $str = substr($str,$length_max,$length_string);
+- $length_string = strlen($str);
++ $length_string = strlen((string) $str);
+
+ /* Need to do minus one to align on the right
+ * the first line with the possible following lines
diff --git a/net/phpldapadmin/files/patch-lib_functions.php b/net/phpldapadmin/files/patch-lib_functions.php
--- a/net/phpldapadmin/files/patch-lib_functions.php
+++ b/net/phpldapadmin/files/patch-lib_functions.php
@@ -1,31 +1,454 @@
--- lib/functions.php.orig 2021-12-12 02:35:51 UTC
+++ lib/functions.php
-@@ -928,7 +928,7 @@ function get_cached_item($index,$item,$subitem='null')
- *
- * Returns true on success of false on failure.
- */
--function set_cached_item($index,$item,$subitem='null',$data) {
-+function set_cached_item($index,$data,$item,$subitem='null') {
+@@ -161,7 +161,7 @@ function app_error_handler($errno,$errstr,$file,$linen
+ }
+
+ # Take out extra spaces in error strings.
+- $errstr = preg_replace('/\s+/',' ',$errstr);
++ $errstr = preg_replace('/\s+/',' ',is_null($errstr)? "":$errstr);
+
+ if ($errno == E_NOTICE) {
+ $body = '<table class="notice">';
+@@ -214,9 +214,9 @@ function app_version() {
+ $CACHE = 'UNKNOWN';
+
+ else {
+- $version = rtrim(file_get_contents($version_file));
++ $version = rtrim((string) file_get_contents($version_file));
+
+- $CACHE = preg_replace('/^RELEASE-([0-9\.]+(-.*)*)$/','$1',$version);
++ $CACHE = preg_replace('/^RELEASE-([0-9\.]+(-.*)*)$/','$1',is_null($version)? "":$version);
+
+ # Check if we are a CVS copy.
+ if (preg_match('/^(DEVEL)?$/',$CACHE))
+@@ -525,7 +525,8 @@ function debug_log($msg,$level,$indent) {
+
+ # Pull the file/line/method
+ if (is_string($args[0]) && preg_match('/.php$/',$args[0])) {
+- $file = preg_replace('/.php$/','',array_shift($args));
++ $file_a_shift = array_shift($args);
++ $file = preg_replace('/.php$/','',is_null($file_a_shift? "":$file_a_shift));
+ $line = array_shift($args);
+ $method = array_shift($args);
+
+@@ -550,7 +551,7 @@ function debug_log($msg,$level,$indent) {
+ }
+
+ if (preg_match('/%%/',$msg))
+- $msg = preg_replace('/%%/',join('|',$fargs),$msg);
++ $msg = preg_replace('/%%/',join('|',$fargs),is_null($msg)? "":$msg);
+ else
+ $msg = vsprintf($msg,array_values($fargs));
+
+@@ -761,11 +762,11 @@ function blowfish_encrypt($data,$secret=null) {
+ debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
+
+ # If our secret is null or blank, get the default.
+- if ($secret === null || ! trim($secret))
++ if ($secret === null || ! trim((string) $secret))
+ $secret = $_SESSION[APPCONFIG]->getValue('session','blowfish') ? $_SESSION[APPCONFIG]->getValue('session','blowfish') : session_id();
+
+ # If the secret isnt set, then just return the data.
+- if (! trim($secret))
++ if (! trim((string) $secret))
+ return $data;
+
+ if (! empty($data) && function_exists('openssl_encrypt') && in_array('bf-ecb', openssl_get_cipher_methods())) {
+@@ -791,10 +792,10 @@ function blowfish_encrypt($data,$secret=null) {
+ $pma_cipher = new Horde_Cipher_blowfish;
+ $encrypt = '';
+
+- for ($i=0; $i<strlen($data); $i+=8) {
++ for ($i=0; $i<strlen((string) $data); $i+=8) {
+ $block = substr($data, $i, 8);
+
+- if (strlen($block) < 8)
++ if (strlen((string) $block) < 8)
+ $block = full_str_pad($block,8,"\0", 1);
+
+ $encrypt .= $pma_cipher->encryptBlock($block, $secret);
+@@ -822,11 +823,11 @@ function blowfish_decrypt($encdata,$secret=null) {
+ return $CACHE[$encdata];
+
+ # If our secret is null or blank, get the default.
+- if ($secret === null || ! trim($secret))
++ if ($secret === null || ! trim((string) $secret))
+ $secret = $_SESSION[APPCONFIG]->getValue('session','blowfish') ? $_SESSION[APPCONFIG]->getValue('session','blowfish') : session_id();
+
+ # If the secret isnt set, then just return the data.
+- if (! trim($secret))
++ if (! trim((string) $secret))
+ return $encdata;
+
+ if (! empty($encdata) && function_exists('openssl_encrypt') && in_array('bf-ecb', openssl_get_cipher_methods())) {
+@@ -838,7 +839,7 @@ function blowfish_decrypt($encdata,$secret=null) {
+ $td = mcrypt_module_open(MCRYPT_BLOWFISH,'',MCRYPT_MODE_ECB,'');
+ $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($td),MCRYPT_DEV_URANDOM);
+ mcrypt_generic_init($td,substr($secret,0,mcrypt_enc_get_key_size($td)),$iv);
+- $decrypted_data = trim(mdecrypt_generic($td,base64_decode($encdata)));
++ $decrypted_data = trim((string) mdecrypt_generic($td,base64_decode($encdata)));
+ mcrypt_generic_deinit($td);
+
+ return $decrypted_data;
+@@ -853,11 +854,11 @@ function blowfish_decrypt($encdata,$secret=null) {
+ $decrypt = '';
+ $data = base64_decode($encdata);
+
+- for ($i=0; $i<strlen($data); $i+=8)
++ for ($i=0; $i<strlen((string) $data); $i+=8)
+ $decrypt .= $pma_cipher->decryptBlock(substr($data, $i, 8), $secret);
+
+ // Strip off our \0's that were added.
+- $return = preg_replace("/\\0*$/",'',$decrypt);
++ $return = preg_replace("/\\0*$/",'',is_null($decrypt)? "":$decrypt);
+ $CACHE[$encdata] = $return;
+ return $return;
+ }
+@@ -876,7 +877,7 @@ function full_str_pad($input,$pad_length,$pad_string='
+ debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
+
+ $str = '';
+- $length = $pad_length - strlen($input);
++ $length = $pad_length - strlen((string) $input);
+
+ if ($length > 0) { // str_repeat doesn't like negatives
+ if ($pad_type == STR_PAD_RIGHT) { // STR_PAD_RIGHT == 1
+@@ -1090,7 +1091,7 @@ function masort(&$data,$sortby,$rev=0) {
+ $code .= " \$a = array_change_key_case(\$a);\n";
+ $code .= " \$b = array_change_key_case(\$b);\n";
+
+- $key = strtolower($key);
++ $key = strtolower((string) $key);
+
+ $code .= " if ((! isset(\$a['$key'])) && isset(\$b['$key'])) return 1;\n";
+ $code .= " if (isset(\$a['$key']) && (! isset(\$b['$key']))) return -1;\n";
+@@ -1248,7 +1249,7 @@ function is_dn_string($str) {
+ $left = $sub_parts[0];
+ $right = $sub_parts[1];
+
+- if ( ! strlen(trim($left)) || ! strlen(trim($right)))
++ if ( ! strlen((string) trim((string) $left)) || ! strlen((string) trim((string) $right)))
+ return false;
+
+ if (strpos($left,'#') !== false)
+@@ -1343,7 +1344,7 @@ function pla_compare_dns($dn1,$dn2) {
+ $dn2 = implode('+',$dn2);
+
+ # If they are obviously the same, return immediately
+- if (! strcasecmp($dn1,$dn2))
++ if (! strcasecmp((string) $dn1,(string) $dn2))
+ return 0;
+
+ $dn1_parts = pla_explode_dn(pla_reverse_dn($dn1));
+@@ -1364,15 +1365,15 @@ function pla_compare_dns($dn1,$dn2) {
+ $dn1_sub_parts = explode('=',$dn1_part,2);
+ $dn2_sub_parts = explode('=',$dn2_part,2);
+
+- $dn1_sub_part_attr = trim($dn1_sub_parts[0]);
+- $dn2_sub_part_attr = trim($dn2_sub_parts[0]);
++ $dn1_sub_part_attr = trim((string) $dn1_sub_parts[0]);
++ $dn2_sub_part_attr = trim((string) $dn2_sub_parts[0]);
+
+- if (0 != ($cmp = strcasecmp($dn1_sub_part_attr,$dn2_sub_part_attr)))
++ if (0 != ((string) $cmp = strcasecmp((string) $dn1_sub_part_attr,(string) $dn2_sub_part_attr)))
+ return $cmp;
+
+- $dn1_sub_part_val = trim($dn1_sub_parts[1]);
+- $dn2_sub_part_val = trim($dn2_sub_parts[1]);
+- if (0 != ($cmp = strcasecmp($dn1_sub_part_val,$dn2_sub_part_val)))
++ $dn1_sub_part_val = trim((string) $dn1_sub_parts[1]);
++ $dn2_sub_part_val = trim((string) $dn2_sub_parts[1]);
++ if (0 != ((string) $cmp = strcasecmp((string) $dn1_sub_part_val,(string) $dn2_sub_part_val)))
+ return $cmp;
+ }
+
+@@ -1430,7 +1431,7 @@ function get_next_number($base,$attr,$increment=false,
+ debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
+
+ $server = $_SESSION[APPCONFIG]->getServer(get_request('server_id','REQUEST'));
+- $attr = strtolower($attr);
++ $attr = strtolower((string) $attr);
+ $query = array();
+
+ if (! $server->getValue('auto_number','enable')) {
+@@ -1457,7 +1458,7 @@ function get_next_number($base,$attr,$increment=false,
+ if (! $base) {
+ $query['base'] = $server->getValue('auto_number','search_base');
+
+- if (! trim($query['base'])) {
++ if (! trim((string) $query['base'])) {
+ system_message(array(
+ 'title'=>_('No AUTO_NUMBER search_base configured for this server'),
+ 'body'=>_('A call was made to get_next_number(), however, the base to search is empty.'),
+@@ -1628,7 +1629,7 @@ function get_icon($server_id,$dn,$object_classes=array
+ $object_classes = $server->getDNAttrValue($dn,'objectClass');
+
+ foreach ($object_classes as $index => $value)
+- $object_classes[$index] = strtolower($value);
++ $object_classes[$index] = strtolower((string) $value);
+
+ $rdn = get_rdn($dn);
+ $rdn_parts = explode('=',$rdn,2);
+@@ -1638,7 +1639,7 @@ function get_icon($server_id,$dn,$object_classes=array
+
+ # Return icon filename based upon objectClass value
+ if (in_array('sambaaccount',$object_classes) &&
+- '$' == $rdn[ strlen($rdn) - 1 ])
++ '$' == $rdn[ strlen((string) $rdn) - 1 ])
+ return 'nt_machine.png';
+
+ if (in_array('sambaaccount',$object_classes))
+@@ -1688,9 +1689,9 @@ function get_icon($server_id,$dn,$object_classes=array
+ $cval = explode('=',$tmp[0],2);
+ $cval = isset($cval[1]) ? $cval[1] : false;
+ if ($cval && false === strpos($cval,'..') &&
+- file_exists(realpath(sprintf('%s/../countries/%s.png',IMGDIR,strtolower($cval)))))
++ file_exists(realpath(sprintf('%s/../countries/%s.png',IMGDIR,strtolower((string) $cval)))))
+
+- return sprintf('../countries/%s.png',strtolower($cval));
++ return sprintf('../countries/%s.png',strtolower((string) $cval));
+
+ else
+ return 'country.png';
+@@ -1777,13 +1778,13 @@ function get_icon($server_id,$dn,$object_classes=array
+ return 'hard-drive.png';
+
+ elseif (strpos($rdn_value,'ipsec') === 0 ||
+- strcasecmp($rdn_value,'IP Security') == 0||
+- strcasecmp($rdn_value,'MSRADIUSPRIVKEY Secret') == 0 ||
++ strcasecmp((string) $rdn_value,'IP Security') == 0||
++ strcasecmp((string) $rdn_value,'MSRADIUSPRIVKEY Secret') == 0 ||
+ strpos($rdn_value,'BCKUPKEY_') === 0)
+
+ return 'lock.png';
+
+- elseif (strcasecmp($rdn_value,'MicrosoftDNS') == 0)
++ elseif (strcasecmp((string) $rdn_value,'MicrosoftDNS') == 0)
+ return 'ldap-dc.png';
+
+ # Oh well, I don't know what it is. Use a generic icon.
+@@ -1802,7 +1803,7 @@ function expand_dn_with_base($base,$sub_dn) {
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
-@@ -2032,8 +2032,8 @@ function ldap_error_msg($msg,$errnum) {
- *
- * Usage Examples:
- * <code>
-- * draw_jpeg_photo(0,'cn=Bob,ou=People,dc=example,dc=com',"jpegPhoto",0,true,array('img_opts'=>"border: 1px; width: 150px"));
-- * draw_jpeg_photo(1,'cn=Fred,ou=People,dc=example,dc=com',null,1);
-+ * draw_jpeg_photo(0,'cn=Bob,ou=People,dc=example,dc=com',0,"jpegPhoto",true,array('img_opts'=>"border: 1px; width: 150px"));
-+ * draw_jpeg_photo(1,'cn=Fred,ou=People,dc=example,dc=com',1,null);
- * </code>
- *
- * @param object The Server to get the image from.
-@@ -2046,7 +2046,7 @@ function ldap_error_msg($msg,$errnum) {
- * @param array Specifies optional image and CSS style attributes for the table tag. Supported keys are
- * fixed_width, fixed_height, img_opts.
- */
--function draw_jpeg_photo($server,$dn,$attr_name='jpegphoto',$index,$draw_delete_buttons=false,$options=array()) {
-+function draw_jpeg_photo($server,$dn,$index,$attr_name='jpegphoto',$draw_delete_buttons=false,$options=array()) {
+- $empty_str = (is_null($sub_dn) || (($len=strlen(trim($sub_dn))) == 0));
++ $empty_str = (is_null($sub_dn) || (($len=strlen((string) trim((string) $sub_dn))) == 0));
+
+ if ($empty_str)
+ return $base;
+@@ -1927,7 +1928,7 @@ function pla_verbose_error($key) {
+ $hex_code = isset($entry[1]) ? $entry[1] : null;
+ $title = isset($entry[2]) ? $entry[2] : null;
+ $desc = isset($entry[3]) ? $entry[3] : null;
+- $desc = preg_replace('/\s+/',' ',$desc);
++ $desc = preg_replace('/\s+/',' ',is_null($desc)? "":$desc);
+ $CACHE[$hex_code] = array('title'=>$title,'desc'=>$desc);
+ }
+ }
+@@ -1984,7 +1985,7 @@ function support_oid_to_text($key) {
+ $CACHE[$oid_id]['title'] = isset($entry[4]) ? $entry[4] : null;
+ $CACHE[$oid_id]['ref'] = isset($entry[6]) ? $entry[6] : null;
+ $desc = isset($entry[8]) ? $entry[8] : sprintf('<acronym title="%s">%s</acronym>',$unknown['desc'],$unknown['title']);
+- $CACHE[$oid_id]['desc'] = preg_replace('/\s+/',' ',$desc);
++ $CACHE[$oid_id]['desc'] = preg_replace('/\s+/',' ',is_null($desc)? "":$desc);
+ }
+ }
+ }
+@@ -2164,7 +2165,7 @@ function pla_password_hash($password_clear,$enc_type)
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
+- $enc_type = strtolower($enc_type);
++ $enc_type = strtolower((string) $enc_type);
+
+ switch($enc_type) {
+ case 'blowfish':
+@@ -2335,7 +2336,7 @@ function password_check($cryptedpassword,$plainpasswor
+
+ if (preg_match('/{([^}]+)}(.*)/',$cryptedpassword,$matches)) {
+ $cryptedpassword = $matches[2];
+- $cypher = strtolower($matches[1]);
++ $cypher = strtolower((string) $matches[1]);
+
+ } else {
+ $cypher = null;
+@@ -2389,7 +2390,7 @@ function password_check($cryptedpassword,$plainpasswor
+
+ # SHA crypted passwords
+ case 'sha':
+- if (strcasecmp(pla_password_hash($plainpassword,'sha'),'{SHA}'.$cryptedpassword) == 0)
++ if (strcasecmp(pla_password_hash((string) $plainpassword,'sha'),'{SHA}'.(string) $cryptedpassword) == 0)
+ return true;
+ else
+ return false;
+@@ -2398,7 +2399,7 @@ function password_check($cryptedpassword,$plainpasswor
+
+ # MD5 crypted passwords
+ case 'md5':
+- if( strcasecmp(pla_password_hash($plainpassword,'md5'),'{MD5}'.$cryptedpassword) == 0)
++ if( strcasecmp(pla_password_hash((string) $plainpassword,'md5'),'{MD5}'.(string) $cryptedpassword) == 0)
+ return true;
+ else
+ return false;
+@@ -2463,7 +2464,7 @@ function password_check($cryptedpassword,$plainpasswor
+
+ # SHA256 crypted passwords
+ case 'sha256':
+- if (strcasecmp(pla_password_hash($plainpassword,'sha256'),'{SHA256}'.$cryptedpassword) == 0)
++ if (strcasecmp(pla_password_hash((string) $plainpassword,'sha256'),'{SHA256}'.(string) $cryptedpassword) == 0)
+ return true;
+ else
+ return false;
+@@ -2485,7 +2486,7 @@ function password_check($cryptedpassword,$plainpasswor
+
+ # SHA384 crypted passwords
+ case 'sha384':
+- if (strcasecmp(pla_password_hash($plainpassword,'sha384'),'{SHA384}'.$cryptedpassword) == 0)
++ if (strcasecmp(pla_password_hash((string) $plainpassword,'sha384'),'{SHA384}'.(string) $cryptedpassword) == 0)
+ return true;
+ else
+ return false;
+@@ -2507,7 +2508,7 @@ function password_check($cryptedpassword,$plainpasswor
+
+ # SHA512 crypted passwords
+ case 'sha512':
+- if (strcasecmp(pla_password_hash($plainpassword,'sha512'),'{SHA512}'.$cryptedpassword) == 0)
++ if (strcasecmp(pla_password_hash((string) $plainpassword,'sha512'),'{SHA512}'.(string) $cryptedpassword) == 0)
+ return true;
+ else
+ return false;
+@@ -2554,12 +2555,12 @@ function get_enc_type($user_password) {
+ $enc_type = null;
+
+ if (preg_match('/{([^}]+)}/',$user_password,$enc_type))
+- $enc_type = strtolower($enc_type[1]);
++ $enc_type = strtolower((string) $enc_type[1]);
+ else
+ return null;
+
+ # Handle crypt types
+- if (strcasecmp($enc_type,'crypt') == 0) {
++ if (strcasecmp((string) $enc_type,'crypt') == 0) {
+
+ # No need to check for standard crypt, because enc_type is already equal to 'crypt'.
+ if (preg_match('/{[^}]+}\\$1\\$+/',$user_password))
+@@ -2698,9 +2699,9 @@ function dn_escape($dn) {
+
+ # Check if the RDN has a comma and escape it.
+ while (preg_match('/([^\\\\]),(\s*[^=]*\s*),/',$dn))
+- $dn = preg_replace('/([^\\\\]),(\s*[^=]*\s*),/','$1\\\\2C$2,',$dn);
++ $dn = preg_replace('/([^\\\\]),(\s*[^=]*\s*),/','$1\\\\2C$2,',is_null($dn)? "":$dn);
+
+- $dn = preg_replace('/([^\\\\]),(\s*[^=]*\s*)([^,])$/','$1\\\\2C$2$3',$dn);
++ $dn = preg_replace('/([^\\\\]),(\s*[^=]*\s*)([^,])$/','$1\\\\2C$2$3',is_null($dn)? "":$dn);
+
+ if (DEBUG_ENABLED)
+ debug_log('Returning (%s)',1,0,__FILE__,__LINE__,__METHOD__,$dn);
+@@ -2872,17 +2873,17 @@ function sortAttrs($a,$b) {
+ $b_key = array_search($b->getName(),$attrs_display_order);
+
+ if ((! $a_key) && ($a_key !== 0))
+- if ((! $a_key = array_search(strtolower($a->getFriendlyName()),$attrs_display_order)) && ($a_key !== 0))
++ if ((! $a_key = array_search(strtolower((string) $a->getFriendlyName()),$attrs_display_order)) && ($a_key !== 0))
+ $a_key = count($attrs_display_order)+1;
+
+ if ((! $b_key) && ($b_key !== 0))
+- if ((! $b_key = array_search(strtolower($b->getFriendlyName()),$attrs_display_order)) && ($b_key !== 0))
++ if ((! $b_key = array_search(strtolower((string) $b->getFriendlyName()),$attrs_display_order)) && ($b_key !== 0))
+ $b_key = count($attrs_display_order)+1;
+
+ # Case where neither $a, nor $b are in $attrs_display_order, $a_key = $b_key = one greater than num elements.
+ # So we sort them alphabetically
+ if ($a_key === $b_key)
+- return strcasecmp($a->getFriendlyName(),$b->getFriendlyName());
++ return strcasecmp((string) $a->getFriendlyName(),(string) $b->getFriendlyName());
+
+ # Case where at least one attribute or its friendly name is in $attrs_display_order
+ # return -1 if $a before $b in $attrs_display_order
+@@ -2904,7 +2905,7 @@ function arrayLower($array) {
+
+ $newarray = array();
+ foreach ($array as $key => $value)
+- $newarray[$key] = strtolower($value);
++ $newarray[$key] = strtolower((string) $value);
+
+ return $newarray;
+ }
+@@ -2929,7 +2930,7 @@ function in_array_ignore_case($needle,$haystack) {
+ $return = false;
+
+ foreach ($haystack as $element) {
+- if (is_string($element) && (strcasecmp($needle,$element) == 0)) {
++ if (is_string((string) $element) && (strcasecmp((string) $needle,(string) $element) == 0)) {
+ $return = true;
+ break;
+ }
+@@ -2961,13 +2962,13 @@ function draw_formatted_dn($server,$entry) {
+ debug_log('The tokens are (%s)',1,0,__FILE__,__LINE__,__METHOD__,$tokens);
+
+ foreach ($tokens as $token) {
+- if (strcasecmp($token,'%dn') == 0)
++ if (strcasecmp((string) $token,'%dn') == 0)
+ $format = str_replace($token,pretty_print_dn($dn),$format);
+
+- elseif (strcasecmp($token,'%rdn') == 0)
++ elseif (strcasecmp((string) $token,'%rdn') == 0)
+ $format = str_replace($token,pretty_print_dn($entry->getRDN()),$format);
+
+- elseif (strcasecmp($token,'%rdnvalue') == 0) {
++ elseif (strcasecmp((string) $token,'%rdnvalue') == 0) {
+ $rdn = get_rdn($dn,0,true);
+ $rdn_value = explode('=',$rdn,2);
+ $rdn_value = $rdn_value[1];
+@@ -3046,7 +3047,7 @@ function littleEndian($hex) {
+
+ $result = '';
+
+- for ($x=strlen($hex)-2;$x>= 0;$x=$x-2)
++ for ($x=strlen((string) $hex)-2;$x>= 0;$x=$x-2)
+ $result .= substr($hex,$x,2);
+
+ return $result;
+@@ -3088,7 +3089,7 @@ function return_ldap_hash($base,$filter,$key,$attrs,$s
+ debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
+
+ $server = $_SESSION[APPCONFIG]->getServer(get_request('server_id','REQUEST'));
+- $key = strtolower($key);
++ $key = strtolower((string) $key);
+
+ $query = array();
+ $query['base'] = $base;
+@@ -3103,21 +3104,21 @@ function return_ldap_hash($base,$filter,$key,$attrs,$s
+ if (is_array($values[$key]))
+ foreach ($values[$key] as $i => $k)
+ foreach ($attrs as $attr) {
+- $lattr = strtolower($attr);
++ $lattr = strtolower((string) $attr);
+ if (isset($values[$lattr])) {
+ $v = '';
+
+ if (is_array($values[$lattr]) && isset($values[$lattr][$i]))
+ $v = $values[$lattr][$i];
+
+- if (is_string($v) && (strlen($v) > 0))
++ if (is_string($v) && (strlen((string) $v) > 0))
+ $results[$k][$attr] = $v;
+ }
+ }
+
+ else
+ foreach ($attrs as $attr) {
+- $lattr = strtolower($attr);
++ $lattr = strtolower((string) $attr);
+ if (isset($values[$lattr]))
+ $results[$values[$key]][$attr] = $values[$lattr];
+ }
+@@ -3263,7 +3264,7 @@ function random_junk() {
+ * @return string
+ */
+ function htmlid($sid,$dn) {
+- return sprintf('SID%s:%s',$sid,preg_replace('/[\ =,]/','_',$dn));
++ return sprintf('SID%s:%s',$sid,preg_replace('/[\ =,]/','_',is_null($dn)? "":$dn));
+ }
+
+ /**
diff --git a/net/phpldapadmin/files/patch-lib_import__functions.php b/net/phpldapadmin/files/patch-lib_import__functions.php
new file mode 100644
--- /dev/null
+++ b/net/phpldapadmin/files/patch-lib_import__functions.php
@@ -0,0 +1,104 @@
+--- lib/import_functions.php.orig 2021-12-12 02:35:51 UTC
++++ lib/import_functions.php
+@@ -86,7 +86,7 @@ abstract class Import {
+ if (get_request('ldif','REQUEST')) {
+ $this->input = explode("\n",get_request('ldif','REQUEST'));
+ $this->source['name'] = 'STDIN';
+- $this->source['size'] = strlen(get_request('ldif','REQUEST'));
++ $this->source['size'] = strlen((string) get_request('ldif','REQUEST'));
+
+ } elseif (isset($_FILES['ldif_file']) && is_array($_FILES['ldif_file']) && ! $_FILES['ldif_file']['error']) {
+ $input = file_get_contents($_FILES['ldif_file']['tmp_name']);
+@@ -253,9 +253,9 @@ class ImportLDIF extends Import {
+
+ # Get the DN
+ if (substr($value,0,1) == ':')
+- $value = base64_decode(trim(substr($value,1)));
++ $value = base64_decode(trim((string) substr($value,1)));
+ else
+- $value = trim($value);
++ $value = trim((string) $value);
+
+ return array($attr,$value);
+ }
+@@ -271,7 +271,7 @@ class ImportLDIF extends Import {
+
+ if ($this->hasMoreEntries() && ! $this->eof()) {
+ # The first line is the DN one
+- $current[0]= trim($this->_currentLine);
++ $current[0]= trim((string) $this->_currentLine);
+
+ # While we end on a blank line, fetch the attribute lines
+ $count = 0;
+@@ -282,11 +282,11 @@ class ImportLDIF extends Import {
+ /* If the next line begin with a space, we append it to the current row
+ * else we push it into the array (unwrap)*/
+ if ($this->isWrappedLine())
+- $current[$count] .= trim($this->_currentLine);
++ $current[$count] .= trim((string) $this->_currentLine);
+ elseif ($this->isCommentLine()) {}
+ # Do nothing
+ elseif (! $this->isBlankLine())
+- $current[++$count] = trim($this->_currentLine);
++ $current[++$count] = trim((string) $this->_currentLine);
+ else
+ $endEntryFound = true;
+ }
+@@ -336,7 +336,7 @@ class ImportLDIF extends Import {
+ * @return boolean true if it's a comment line,false otherwise
+ */
+ private function isCommentLine() {
+- return substr(trim($this->_currentLine),0,1) == '#' ? true : false;
++ return substr(trim((string) $this->_currentLine),0,1) == '#' ? true : false;
+ }
+
+ /**
+@@ -354,7 +354,7 @@ class ImportLDIF extends Import {
+ * @return boolean if it is a blank line,false otherwise.
+ */
+ private function isBlankLine() {
+- return(trim($this->_currentLine) == '') ? true : false;
++ return(trim((string) $this->_currentLine) == '') ? true : false;
+ }
+
+ /**
+@@ -383,10 +383,10 @@ class ImportLDIF extends Import {
+ $return = '';
+
+ if (substr($value,0,1) == '<') {
+- $url = trim(substr($value,1));
++ $url = trim((string) substr($value,1));
+
+ if (preg_match('^file://',$url)) {
+- $filename = substr(trim($url),7);
++ $filename = substr(trim((string) $url),7);
+
+ if ($fh = @fopen($filename,'rb')) {
+ if (! $return = @fread($fh,filesize($filename)))
+@@ -404,7 +404,7 @@ class ImportLDIF extends Import {
+ } else
+ $return = $value;
+
+- return trim($return);
++ return trim((string) $return);
+ }
+
+ /**
+@@ -480,7 +480,7 @@ class ImportLDIF extends Import {
+ # Fetch the attribute for the following line
+ $currentLine = array_shift($lines);
+
+- while ($processline && trim($currentLine) && (trim($currentLine) != '-')) {
++ while ($processline && trim((string) $currentLine) && (trim((string) $currentLine) != '-')) {
+ $processline = false;
+
+ # If there is a valid line
+@@ -541,7 +541,7 @@ class ImportLDIF extends Import {
+ array_merge(array($currentLine),$lines));
+
+ $currentLine = array_shift($lines);
+- if (trim($currentLine))
++ if (trim((string) $currentLine))
+ $processline = true;
+ }
+
diff --git a/net/phpldapadmin/files/patch-lib_page.php b/net/phpldapadmin/files/patch-lib_page.php
new file mode 100644
--- /dev/null
+++ b/net/phpldapadmin/files/patch-lib_page.php
@@ -0,0 +1,29 @@
+--- lib/page.php.orig 2021-12-12 02:35:51 UTC
++++ lib/page.php
+@@ -184,7 +184,7 @@ class page {
+ $empty = true;
+ if (function_exists('cmd_control_pane'))
+ foreach (cmd_control_pane('main') as $cmddetails)
+- if ((isset($cmddetails['enable']) && trim($cmddetails['enable'])) || ! isset($cmddetails['enable'])) {
++ if ((isset($cmddetails['enable']) && trim((string) $cmddetails['enable'])) || ! isset($cmddetails['enable'])) {
+ if (! $empty)
+ echo ' | ';
+
+@@ -358,7 +358,7 @@ class page {
+
+ if (defined('DEBUG_ENABLED') && DEBUG_ENABLED)
+ debug_log('Sending COMPRESSED output to browser[(%s),%s]',129,0,__FILE__,__LINE__,__METHOD__,
+- strlen($output),$output);
++ strlen((string) $output),$output);
+
+ print gzencode($output);
+ }
+@@ -445,7 +445,7 @@ class page {
+
+ if (defined('DEBUG_ENABLED') && DEBUG_ENABLED)
+ debug_log('Sending COMPRESSED output to browser[(%s),%s]',129,0,__FILE__,__LINE__,__METHOD__,
+- strlen($output),$output);
++ strlen((string) $output),$output);
+
+ print gzencode($output);
+ }
diff --git a/net/phpldapadmin/files/patch-lib_schema__functions.php b/net/phpldapadmin/files/patch-lib_schema__functions.php
new file mode 100644
--- /dev/null
+++ b/net/phpldapadmin/files/patch-lib_schema__functions.php
@@ -0,0 +1,365 @@
+--- lib/schema_functions.php.orig 2021-12-12 02:35:51 UTC
++++ lib/schema_functions.php
+@@ -74,7 +74,7 @@ abstract class SchemaItem {
+ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
+ debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->name);
+
+- return $lower ? strtolower($this->name) : $this->name;
++ return $lower ? strtolower((string) $this->name) : $this->name;
+ }
+ }
+
+@@ -125,7 +125,7 @@ class ObjectClass extends SchemaItem {
+ if ($strings[$i+1]!='(') {
+ do {
+ $i++;
+- if (strlen($this->name) == 0)
++ if (strlen((string) $this->name) == 0)
+ $this->name = $strings[$i];
+ else
+ $this->name .= ' '.$strings[$i];
+@@ -136,7 +136,7 @@ class ObjectClass extends SchemaItem {
+ $i++;
+ do {
+ $i++;
+- if (strlen($this->name) == 0)
++ if (strlen((string) $this->name) == 0)
+ $this->name = $strings[$i];
+ else
+ $this->name .= ' '.$strings[$i];
+@@ -148,8 +148,8 @@ class ObjectClass extends SchemaItem {
+ } while (! preg_match('/\)+\)?/',$strings[$i]));
+ }
+
+- $this->name = preg_replace('/^\'/','',$this->name);
+- $this->name = preg_replace('/\'$/','',$this->name);
++ $this->name = preg_replace('/^\'/','',is_null($this->name)? "":$this->name);
++ $this->name = preg_replace('/\'$/','',is_null($this->name)? "":$this->name);
+
+ if (DEBUG_ENABLED)
+ debug_log('Case NAME returned (%s)',8,0,__FILE__,__LINE__,__METHOD__,$this->name);
+@@ -158,7 +158,7 @@ class ObjectClass extends SchemaItem {
+ case 'DESC':
+ do {
+ $i++;
+- if (strlen($this->description) == 0)
++ if (strlen((string) $this->description) == 0)
+ $this->description=$this->description.$strings[$i];
+ else
+ $this->description=$this->description.' '.$strings[$i];
+@@ -179,14 +179,14 @@ class ObjectClass extends SchemaItem {
+ case 'SUP':
+ if ($strings[$i+1] != '(') {
+ $i++;
+- array_push($this->sup_classes,preg_replace("/'/",'',$strings[$i]));
++ array_push($this->sup_classes,preg_replace("/'/",'',is_null($strings[$i])? "":$strings[$i]));
+
+ } else {
+ $i++;
+ do {
+ $i++;
+ if ($strings[$i] != '$')
+- array_push($this->sup_classes,preg_replace("/'/",'',$strings[$i]));
++ array_push($this->sup_classes,preg_replace("/'/",'',is_null($strings[$i])? "":$strings[$i]));
+
+ } while (! preg_match('/\)+\)?/',$strings[$i+1]));
+ }
+@@ -267,8 +267,8 @@ class ObjectClass extends SchemaItem {
+ }
+ }
+
+- $this->description = preg_replace("/^\'/",'',$this->description);
+- $this->description = preg_replace("/\'$/",'',$this->description);
++ $this->description = preg_replace("/^\'/",'',is_null($this->description)? "":$this->description);
++ $this->description = preg_replace("/\'$/",'',is_null($this->description)? "":$this->description);
+
+ if (DEBUG_ENABLED)
+ debug_log('Returning () - NAME (%s), DESCRIPTION (%s), MUST (%s), MAY (%s), FORCE MAY (%s)',9,0,__FILE__,__LINE__,__METHOD__,
+@@ -293,13 +293,13 @@ class ObjectClass extends SchemaItem {
+ if (! preg_match('/^\(/',$string)) {
+ # A bareword only - can be terminated by a ) if the last item
+ if (preg_match('/\)+$/',$string))
+- $string = preg_replace('/\)+$/','',$string);
++ $string = preg_replace('/\)+$/','',is_null($string)? "":$string);
+
+ array_push($attrs,$string);
+
+ } elseif (preg_match('/^\(.*\)$/',$string)) {
+- $string = preg_replace('/^\(/','',$string);
+- $string = preg_replace('/\)+$/','',$string);
++ $string = preg_replace('/^\(/','',is_null($string)? "":$string);
++ $string = preg_replace('/\)+$/','',is_null($string)? "":$string);
+ array_push($attrs,$string);
+
+ } else {
+@@ -308,7 +308,7 @@ class ObjectClass extends SchemaItem {
+ $i++;
+
+ } elseif (preg_match('/^\(./',$string)) {
+- $string = preg_replace('/^\(/','',$string);
++ $string = preg_replace('/^\(/','',is_null($string)? "":$string);
+ array_push($attrs,$string);
+ $i++;
+ }
+@@ -323,7 +323,7 @@ class ObjectClass extends SchemaItem {
+ }
+
+ if (preg_match('/\)$/',$string))
+- $string = preg_replace('/\)+$/','',$string);
++ $string = preg_replace('/\)+$/','',is_null($string)? "":$string);
+ else
+ $i++;
+
+@@ -519,10 +519,10 @@ class ObjectClass extends SchemaItem {
+ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
+ debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
+
+- $name = trim($name);
++ $name = trim((string) $name);
+
+ foreach ($this->children_objectclasses as $existing_objectclass)
+- if (strcasecmp($name,$existing_objectclass) == 0)
++ if (strcasecmp((string) $name,(string) $existing_objectclass) == 0)
+ return false;
+
+ array_push($this->children_objectclasses,$name);
+@@ -683,7 +683,7 @@ class ObjectClass_ObjectClassAttribute {
+ if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
+ debug_log('Entered (%%)',9,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->name);
+
+- return $lower ? strtolower($this->name) : $this->name;
++ return $lower ? strtolower((string) $this->name) : $this->name;
+ }
+
+ # Gets the name of the ObjectClass which originally specified this attribute.
+@@ -754,7 +754,7 @@ class AttributeType extends SchemaItem {
+ if ($strings[$i+1] != '(' && ! preg_match('/^\(/',$strings[$i+1])) {
+ do {
+ $i++;
+- if (strlen($this->name)==0)
++ if (strlen((string) $this->name)==0)
+ $this->name = $strings[$i];
+ else
+ $this->name .= ' '.$strings[$i];
+@@ -769,11 +769,11 @@ class AttributeType extends SchemaItem {
+ do {
+ # In case we came here becaues of a ('
+ if (preg_match('/^\(/',$strings[$i]))
+- $strings[$i] = preg_replace('/^\(/','',$strings[$i]);
++ $strings[$i] = preg_replace('/^\(/','',is_null($strings[$i])? "":$strings[$i]);
+ else
+ $i++;
+
+- if (strlen($this->name) == 0)
++ if (strlen((string) $this->name) == 0)
+ $this->name = $strings[$i];
+ else
+ $this->name .= ' '.$strings[$i];
+@@ -783,8 +783,8 @@ class AttributeType extends SchemaItem {
+ # Add alias names for this attribute
+ while ($strings[++$i] != ')') {
+ $alias = $strings[$i];
+- $alias = preg_replace("/^\'/",'',$alias);
+- $alias = preg_replace("/\'$/",'',$alias);
++ $alias = preg_replace("/^\'/",'',is_null($alias)? "":$alias);
++ $alias = preg_replace("/\'$/",'',is_null($alias)? "":$alias);
+ $this->addAlias($alias);
+ }
+ }
+@@ -796,7 +796,7 @@ class AttributeType extends SchemaItem {
+ case 'DESC':
+ do {
+ $i++;
+- if (strlen($this->description)==0)
++ if (strlen((string) $this->description)==0)
+ $this->description=$this->description.$strings[$i];
+ else
+ $this->description=$this->description.' '.$strings[$i];
+@@ -848,7 +848,7 @@ class AttributeType extends SchemaItem {
+ case 'SYNTAX':
+ $i++;
+ $this->syntax = $strings[$i];
+- $this->syntax_oid = preg_replace('/{\d+}$/','',$this->syntax);
++ $this->syntax_oid = preg_replace('/{\d+}$/','',is_null($this->syntax)? "":$this->syntax);
+
+ # Does this SYNTAX string specify a max length (ie, 1.2.3.4{16})
+ if (preg_match('/{(\d+)}$/',$this->syntax,$this->max_length))
+@@ -906,16 +906,16 @@ class AttributeType extends SchemaItem {
+ }
+ }
+
+- $this->name = preg_replace("/^\'/",'',$this->name);
+- $this->name = preg_replace("/\'$/",'',$this->name);
+- $this->description = preg_replace("/^\'/",'',$this->description);
+- $this->description = preg_replace("/\'$/",'',$this->description);
+- $this->syntax = preg_replace("/^\'/",'',$this->syntax);
+- $this->syntax = preg_replace("/\'$/",'',$this->syntax);
+- $this->syntax_oid = preg_replace("/^\'/",'',$this->syntax_oid);
+- $this->syntax_oid = preg_replace("/\'$/",'',$this->syntax_oid);
+- $this->sup_attribute = preg_replace("/^\'/",'',$this->sup_attribute);
+- $this->sup_attribute = preg_replace("/\'$/",'',$this->sup_attribute);
++ $this->name = preg_replace("/^\'/",'',is_null($this->name)? "":$this->name);
++ $this->name = preg_replace("/\'$/",'',is_null($this->name)? "":$this->name);
++ $this->description = preg_replace("/^\'/",'',is_null($this->description)? "":$this->description);
++ $this->description = preg_replace("/\'$/",'',is_null($this->description)? "":$this->description);
++ $this->syntax = preg_replace("/^\'/",'',is_null($this->syntax)? "":$this->syntax);
++ $this->syntax = preg_replace("/\'$/",'',is_null($this->syntax)? "":$this->syntax);
++ $this->syntax_oid = preg_replace("/^\'/",'',is_null($this->syntax_oid)? "":$this->syntax_oid);
++ $this->syntax_oid = preg_replace("/\'$/",'',is_null($this->syntax_oid)? "":$this->syntax_oid);
++ $this->sup_attribute = preg_replace("/^\'/",'',is_null($this->sup_attribute)? "":$this->sup_attribute);
++ $this->sup_attribute = preg_replace("/\'$/",'',is_null($this->sup_attribute)? "":$this->sup_attribute);
+
+ if (DEBUG_ENABLED)
+ debug_log('Returning ()',9,0,__FILE__,__LINE__,__METHOD__);
+@@ -1006,7 +1006,7 @@ class AttributeType extends SchemaItem {
+ debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
+
+ foreach ($this->aliases as $alias_attr_name)
+- if (strcasecmp($alias_attr_name,$attr_name) == 0)
++ if (strcasecmp((string) $alias_attr_name,(string) $attr_name) == 0)
+ return true;
+
+ return false;
+@@ -1125,7 +1125,7 @@ class AttributeType extends SchemaItem {
+
+ foreach ($this->aliases as $i => $alias_name) {
+
+- if (strcasecmp($alias_name,$remove_alias_name) == 0) {
++ if (strcasecmp((string) $alias_name,(string) $remove_alias_name) == 0) {
+ unset($this->aliases[$i]);
+
+ $this->aliases = array_values($this->aliases);
+@@ -1209,7 +1209,7 @@ class AttributeType extends SchemaItem {
+ if (DEBUG_ENABLED)
+ debug_log('Checking (%s) with (%s)',8,0,__FILE__,__LINE__,__METHOD__,$used_in_object_class,$name);
+
+- if (strcasecmp($used_in_object_class,$name) == 0)
++ if (strcasecmp((string) $used_in_object_class,(string) $name) == 0)
+ return false;
+ }
+
+@@ -1240,7 +1240,7 @@ class AttributeType extends SchemaItem {
+ debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
+
+ foreach ($this->required_by_object_classes as $required_by_object_class)
+- if (strcasecmp($required_by_object_class,$name) == 0)
++ if (strcasecmp((string) $required_by_object_class,(string) $name) == 0)
+ return false;
+
+ array_push($this->required_by_object_classes,$name);
+@@ -1301,7 +1301,7 @@ class Syntax extends SchemaItem {
+ case 'DESC':
+ do {
+ $i++;
+- if (strlen($this->description) == 0)
++ if (strlen((string) $this->description) == 0)
+ $this->description=$this->description.$strings[$i];
+ else
+ $this->description=$this->description.' '.$strings[$i];
+@@ -1314,8 +1314,8 @@ class Syntax extends SchemaItem {
+ }
+ }
+
+- $this->description = preg_replace("/^\'/",'',$this->description);
+- $this->description = preg_replace("/\'$/",'',$this->description);
++ $this->description = preg_replace("/^\'/",'',is_null($this->description)? "":$this->description);
++ $this->description = preg_replace("/\'$/",'',is_null($this->description)? "":$this->description);
+ }
+ }
+
+@@ -1349,7 +1349,7 @@ class MatchingRule extends SchemaItem {
+ if ($strings[$i+1] != '(') {
+ do {
+ $i++;
+- if (strlen($this->name) == 0)
++ if (strlen((string) $this->name) == 0)
+ $this->name = $strings[$i];
+ else
+ $this->name .= ' '.$strings[$i];
+@@ -1359,7 +1359,7 @@ class MatchingRule extends SchemaItem {
+ $i++;
+ do {
+ $i++;
+- if (strlen($this->name) == 0)
++ if (strlen((string) $this->name) == 0)
+ $this->name = $strings[$i];
+ else
+ $this->name .= ' '.$strings[$i];
+@@ -1370,14 +1370,14 @@ class MatchingRule extends SchemaItem {
+ } while (! preg_match('/\)+\)?/',$strings[$i]));
+ }
+
+- $this->name = preg_replace("/^\'/",'',$this->name);
+- $this->name = preg_replace("/\'$/",'',$this->name);
++ $this->name = preg_replace("/^\'/",'',is_null($this->name)? "":$this->name);
++ $this->name = preg_replace("/\'$/",'',is_null($this->name)? "":$this->name);
+ break;
+
+ case 'DESC':
+ do {
+ $i++;
+- if (strlen($this->description)==0)
++ if (strlen((string) $this->description)==0)
+ $this->description=$this->description.$strings[$i];
+ else
+ $this->description=$this->description.' '.$strings[$i];
+@@ -1397,8 +1397,8 @@ class MatchingRule extends SchemaItem {
+ $this->setOID($strings[$i]);
+ }
+ }
+- $this->description = preg_replace("/^\'/",'',$this->description);
+- $this->description = preg_replace("/\'$/",'',$this->description);
++ $this->description = preg_replace("/^\'/",'',is_null($this->description)? "":$this->description);
++ $this->description = preg_replace("/\'$/",'',is_null($this->description)? "":$this->description);
+ }
+
+ /**
+@@ -1423,7 +1423,7 @@ class MatchingRule extends SchemaItem {
+ debug_log('Entered (%%)',9,0,__FILE__,__LINE__,__METHOD__,$fargs);
+
+ foreach ($this->used_by_attrs as $attr_name)
+- if (strcasecmp($attr_name,$attr) == 0)
++ if (strcasecmp((string) $attr_name,(string) $attr) == 0)
+ return false;
+
+ array_push($this->used_by_attrs,$attr);
+@@ -1469,7 +1469,7 @@ class MatchingRuleUse extends SchemaItem {
+ if ($strings[$i+1] != '(') {
+ do {
+ $i++;
+- if (! isset($this->name) || strlen($this->name) == 0)
++ if (! isset($this->name) || strlen((string) $this->name) == 0)
+ $this->name = $strings[$i];
+ else
+ $this->name .= ' '.$strings[$i];
+@@ -1480,7 +1480,7 @@ class MatchingRuleUse extends SchemaItem {
+ $i++;
+ do {
+ $i++;
+- if (strlen($this->name) == 0)
++ if (strlen((string) $this->name) == 0)
+ $this->name = $strings[$i];
+ else
+ $this->name .= ' '.$strings[$i];
+@@ -1491,8 +1491,8 @@ class MatchingRuleUse extends SchemaItem {
+ } while (! preg_match('/\)+\)?/',$strings[$i]));
+ }
+
+- $this->name = preg_replace("/^\'/",'',$this->name);
+- $this->name = preg_replace("/\'$/",'',$this->name);
++ $this->name = preg_replace("/^\'/",'',is_null($this->name)? "":$this->name);
++ $this->name = preg_replace("/\'$/",'',is_null($this->name)? "":$this->name);
+ break;
+
+ case 'APPLIES':
+@@ -1507,8 +1507,8 @@ class MatchingRuleUse extends SchemaItem {
+ while ($strings[$i] != ')') {
+ $i++;
+ $new_attr = $strings[$i];
+- $new_attr = preg_replace("/^\'/",'',$new_attr);
+- $new_attr = preg_replace("/\'$/",'',$new_attr);
++ $new_attr = preg_replace("/^\'/",'',is_null($new_attr)? "":$new_attr);
++ $new_attr = preg_replace("/\'$/",'',is_null($new_attr)? "":$new_attr);
+ array_push($this->used_by_attrs,$new_attr);
+ $i++;
+ }
diff --git a/net/phpldapadmin/files/patch-lib_xml2array.php b/net/phpldapadmin/files/patch-lib_xml2array.php
new file mode 100644
--- /dev/null
+++ b/net/phpldapadmin/files/patch-lib_xml2array.php
@@ -0,0 +1,20 @@
+--- lib/xml2array.php.orig 2021-12-12 02:35:51 UTC
++++ lib/xml2array.php
+@@ -59,7 +59,7 @@ class xml2array {
+ }
+
+ private function tagOpen($parser,$name,$attrs) {
+- $name = strtolower($name);
++ $name = strtolower((string) $name);
+
+ if (isset($this->stack_ref[$name])) {
+ if (! isset($this->stack_ref[$name][0])) {
+@@ -86,7 +86,7 @@ class xml2array {
+ }
+
+ private function tagData($parser,$tagData) {
+- if (trim($tagData) != '') {
++ if (trim((string) $tagData) != '') {
+
+ if (isset($this->stack_ref['#text']))
+ $this->stack_ref['#text'] .= $tagData;
diff --git a/net/phpldapadmin/files/patch-lib_xmlTemplates.php b/net/phpldapadmin/files/patch-lib_xmlTemplates.php
--- a/net/phpldapadmin/files/patch-lib_xmlTemplates.php
+++ b/net/phpldapadmin/files/patch-lib_xmlTemplates.php
@@ -1,11 +1,47 @@
--- lib/xmlTemplates.php.orig 2021-12-12 02:35:51 UTC
+++ lib/xmlTemplates.php
-@@ -140,7 +140,7 @@ abstract class xmlTemplates {
+@@ -85,7 +85,7 @@ abstract class xmlTemplates {
+ $filename = sprintf('%s/%s',$dir,$file);
- if ($changed) {
- masort($this->templates,'title');
-- set_cached_item($server_id,$class['item'],'null',$this->templates);
-+ set_cached_item($server_id,$this->templates,$class['item'],'null');
- }
+ if (! in_array($filename,$this->getTemplateFiles())) {
+- $templatename = preg_replace('/.xml$/','',$file);
++ $templatename = preg_replace('/.xml$/','',is_null($file)? "":$file);
+
+ $this->templates[$index] = new $class['name']($this->server_id,$templatename,$filename,$type,$index);
+ $index++;
+@@ -128,7 +128,7 @@ abstract class xmlTemplates {
+ $filename = sprintf('%s/%s',$dir,$file);
+
+ # Store the template
+- $templatename = preg_replace('/.xml$/','',$file);
++ $templatename = preg_replace('/.xml$/','',is_null($file)? "":$file);
+ $this->templates[$counter] = new $class['name']($this->server_id,$templatename,$filename,$type,$counter);
+ $counter++;
+ }
+@@ -304,7 +304,7 @@ abstract class xmlTemplate {
+ debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
+
+ foreach ($this->attributes as $index => $attribute)
+- if (strtolower($attr) == $attribute->getName() || in_array(strtolower($attr),$attribute->getAliases()))
++ if (strtolower((string) $attr) == $attribute->getName() || in_array(strtolower($attr),$attribute->getAliases()))
+ return $index;
+
+ return null;
+@@ -343,7 +343,7 @@ abstract class xmlTemplate {
+ debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->name);
+
+ if ($lower)
+- return strtolower($this->name);
++ return strtolower((string) $this->name);
+ else
+ return $this->name;
}
+@@ -482,7 +482,7 @@ abstract class xmlTemplate {
+ debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs);
+
+ foreach ($this->attributes as $attribute)
+- if (($attribute->getName() == strtolower($name)) || in_array(strtolower($name),$attribute->getAliases()))
++ if (($attribute->getName() == strtolower((string) $name)) || in_array(strtolower($name),$attribute->getAliases()))
+ return $attribute;
+ return null;

File Metadata

Mime Type
text/plain
Expires
Sun, Feb 23, 1:40 AM (6 h, 25 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16785064
Default Alt Text
D37513.diff (132 KB)

Event Timeline