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 %s %s %s',_('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 '
'; + echo '
'; + echo ''; +@@ -91,12 +91,12 @@ if (! strcasecmp($request['attr'],'objectclass') || ge + printf('%s',_('Enter the value(s) you would like to add:')); + echo ''; + +- if (! strcasecmp($request['attr'],'objectclass')) { ++ if (! strcasecmp((string) $request['attr'],'objectclass')) { + # If our attr is an objectClass, fetch all available objectClasses and remove those from the list that are already defined in the entry + $socs = $app['server']->SchemaObjectClasses(); + + foreach ($request['attribute']->getValues() as $oclass) +- unset($socs[strtolower($oclass)]); ++ unset($socs[strtolower((string) $oclass)]); + + # Draw objectClass selection + echo ''; diff --git a/net/phpldapadmin/files/patch-htdocs_cmd.php b/net/phpldapadmin/files/patch-htdocs_cmd.php new file mode 100644 --- /dev/null +++ b/net/phpldapadmin/files/patch-htdocs_cmd.php @@ -0,0 +1,11 @@ +--- htdocs/cmd.php.orig 2021-12-12 02:35:51 UTC ++++ htdocs/cmd.php +@@ -41,7 +41,7 @@ if (DEBUG_ENABLED) + $www['page'] = new page($app['server']->getIndex()); + + # See if we can render the command +-if (trim($www['cmd'])) { ++if (trim((string) $www['cmd'])) { + # If this is a READ-WRITE operation, the LDAP server must not be in READ-ONLY mode. + if ($app['server']->isReadOnly() && ! in_array(get_request('cmd','REQUEST'),$app['readwrite_cmds'])) + error(_('You cannot perform updates while server is in read-only mode'),'error','index.php'); diff --git a/net/phpldapadmin/files/patch-htdocs_copy.php b/net/phpldapadmin/files/patch-htdocs_copy.php new file mode 100644 --- /dev/null +++ b/net/phpldapadmin/files/patch-htdocs_copy.php @@ -0,0 +1,11 @@ +--- htdocs/copy.php.orig 2021-12-12 02:35:51 UTC ++++ htdocs/copy.php +@@ -21,7 +21,7 @@ $ldap['SRC'] = $_SESSION[APPCONFIG]->getServer(get_req + $ldap['DST'] = $_SESSION[APPCONFIG]->getServer(get_request('server_id_dst')); + + # Error checking +-if (! trim($request['dnDST'])) ++if (! trim((string) $request['dnDST'])) + error(_('You left the destination DN blank.'),'error','index.php'); + + if ($ldap['DST']->isReadOnly()) diff --git a/net/phpldapadmin/files/patch-htdocs_download__binary__attr.php b/net/phpldapadmin/files/patch-htdocs_download__binary__attr.php new file mode 100644 --- /dev/null +++ b/net/phpldapadmin/files/patch-htdocs_download__binary__attr.php @@ -0,0 +1,11 @@ +--- htdocs/download_binary_attr.php.orig 2021-12-12 02:35:51 UTC ++++ htdocs/download_binary_attr.php +@@ -15,7 +15,7 @@ require './common.php'; + + $request = array(); + $request['dn'] = get_request('dn','GET'); +-$request['attr'] = strtolower(get_request('attr','GET',true)); ++$request['attr'] = strtolower((string) get_request('attr','GET',true)); + $request['index'] = get_request('index','GET',false,0); + $request['type'] = get_request('type','GET',false,'octet-stream'); + $request['filename'] = get_request('filename','GET',false,sprintf('%s:%s.bin',get_rdn($request['dn'],true),$request['attr'])); diff --git a/net/phpldapadmin/files/patch-htdocs_export__form.php b/net/phpldapadmin/files/patch-htdocs_export__form.php new file mode 100644 --- /dev/null +++ b/net/phpldapadmin/files/patch-htdocs_export__form.php @@ -0,0 +1,11 @@ +--- htdocs/export_form.php.orig 2021-12-12 02:35:51 UTC ++++ htdocs/export_form.php +@@ -166,7 +166,7 @@ function get_line_end_format() { + */ + function get_user_agent_string() { + if (isset($_SERVER['HTTP_USER_AGENT'])) +- return strtolower($_SERVER['HTTP_USER_AGENT']); ++ return strtolower((string) $_SERVER['HTTP_USER_AGENT']); + else + return ''; + } diff --git a/net/phpldapadmin/files/patch-htdocs_login.php b/net/phpldapadmin/files/patch-htdocs_login.php new file mode 100644 --- /dev/null +++ b/net/phpldapadmin/files/patch-htdocs_login.php @@ -0,0 +1,11 @@ +--- htdocs/login.php.orig 2021-12-12 02:35:51 UTC ++++ htdocs/login.php +@@ -22,7 +22,7 @@ if ($pass) { + $user['password'] = get_request('login_pass'); + $user['password'] = html_entity_decode($user['password'], ENT_QUOTES); + +- if ($user['login'] && !strlen($user['password'])) { ++ if ($user['login'] && empty($user['password'])) { + system_message(array( + 'title' => _('Authenticate to server'), + 'body' => _('You left the password blank.'), diff --git a/net/phpldapadmin/files/patch-htdocs_login__form.php b/net/phpldapadmin/files/patch-htdocs_login__form.php new file mode 100644 --- /dev/null +++ b/net/phpldapadmin/files/patch-htdocs_login__form.php @@ -0,0 +1,16 @@ +--- htdocs/login_form.php.orig 2021-12-12 02:35:51 UTC ++++ htdocs/login_form.php +@@ -19,11 +19,11 @@ echo '
'; + $isHTTPS = false; + + # Check if the current connection is encrypted +-if (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') { ++if (isset($_SERVER['HTTPS']) && strtolower((string) $_SERVER['HTTPS']) == 'on') { + $isHTTPS = true; + } + # Check if a proxy server downstream does encryption for us +-elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower($_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && strtolower($_SERVER['HTTP_X_FORWARDED_SSL']) ++elseif (!empty($_SERVER['HTTP_X_FORWARDED_PROTO']) && strtolower((string) $_SERVER['HTTP_X_FORWARDED_PROTO']) == 'https' || !empty($_SERVER['HTTP_X_FORWARDED_SSL']) && strtolower($_SERVER['HTTP_X_FORWARDED_SSL']) + == 'on') { + $isHTTPS = true; + } diff --git a/net/phpldapadmin/files/patch-htdocs_monitor.php b/net/phpldapadmin/files/patch-htdocs_monitor.php new file mode 100644 --- /dev/null +++ b/net/phpldapadmin/files/patch-htdocs_monitor.php @@ -0,0 +1,29 @@ +--- htdocs/monitor.php.orig 2021-12-12 02:35:51 UTC ++++ htdocs/monitor.php +@@ -48,7 +48,7 @@ foreach (array( + if (isset($results[$dn]['description'])) { + $description = implode(' ',$results[$dn]['description']); + +- $description = preg_replace('/"/','\'',$description); ++ $description = preg_replace('/"/','\'',is_null($description)? "":$description); + } else { + $description = ''; + } +@@ -103,7 +103,7 @@ foreach (array( + else + $sc = $results[$key][$attr]; + +- if (strcasecmp('supportedcontrol',$attr) == 0) ++ if (strcasecmp('supportedcontrol',(string) $attr) == 0) + foreach ($sc as $control) { + $oidtotext = support_oid_to_text($control); + +@@ -199,7 +199,7 @@ foreach (array( + ) as $dn ) { + + $description = implode(' ',$results[$dn]['description']); +- $description = preg_replace('/"/','\'',$description); ++ $description = preg_replace('/"/','\'',is_null($description)? "":$description); + + printf('',$description,$dn); + echo '',$counter%2 ? 'odd' : 'even',$rule->getName(), +- strcasecmp($entry['value'],$rule->getName()) ? 'none' : ''); ++ strcasecmp((string) $entry['value'],(string) $rule->getName()) ? 'none' : ''); + else + printf('',$counter%2 ? 'odd' : 'even',$rule->getName()); + printf('',$oid); +@@ -467,12 +467,12 @@ switch($entry['view']) { + echo '
'; + + foreach ($socs as $name => $oclass) { +- if (isAjaxEnabled() || (is_null($entry['value']) || ! trim($entry['value']) || $entry['value']==$oclass->getName())) { +- if ((! is_null($entry['value']) && $entry['value']==$oclass->getName()) || ! trim($entry['value'])) ++ if (isAjaxEnabled() || (is_null($entry['value']) || ! trim((string) $entry['value']) || $entry['value']==$oclass->getName())) { ++ if ((! is_null($entry['value']) && $entry['value']==$oclass->getName()) || ! trim((string) $entry['value'])) + $entry['viewed'] = true; + + if (isAjaxEnabled() && $entry['value']) +- printf('
',$oclass->getName(),strcasecmp($entry['value'],$oclass->getName()) ? 'none' : ''); ++ printf('
',(string) $oclass->getName(),strcasecmp((string) $entry['value'],(string) $oclass->getName()) ? 'none' : ''); + else + printf('
',$oclass->getName()); + +@@ -494,10 +494,10 @@ switch($entry['view']) { + + else + foreach ($oclass->getSupClasses() as $i => $object_class) { +- $href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower($object_class))); ++ $href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower((string) $object_class))); + if (isAjaxEnabled()) + printf('%s', +- $href,strtolower($object_class),$object_class); ++ $href,strtolower((string) $object_class),$object_class); + else + printf('%s', + $href,$object_class,_('Jump to this objectClass definition'),$object_class); +@@ -508,7 +508,7 @@ switch($entry['view']) { + echo '
'; + + printf('',$oidtext['title']); + + else +- if (strlen($value) > 0) ++ if (strlen((string) $value) > 0) + printf('',$value); + + } else { +@@ -69,7 +69,7 @@ foreach ($attrs as $key => $values) { + + print ''; + +- if (isset($oidtext['desc']) && trim($oidtext['desc'])) ++ if (isset($oidtext['desc']) && trim((string) $oidtext['desc'])) + printf('',$oidtext['desc']); + else + echo ''; diff --git a/net/phpldapadmin/files/patch-htdocs_view__jpeg__photo.php b/net/phpldapadmin/files/patch-htdocs_view__jpeg__photo.php new file mode 100644 --- /dev/null +++ b/net/phpldapadmin/files/patch-htdocs_view__jpeg__photo.php @@ -0,0 +1,11 @@ +--- htdocs/view_jpeg_photo.php.orig 2021-12-12 02:35:51 UTC ++++ htdocs/view_jpeg_photo.php +@@ -15,7 +15,7 @@ require './common.php'; + + $request = array(); + $request['dn'] = get_request('dn','GET'); +-$request['attr'] = strtolower(get_request('attr','GET',false,'jpegphoto')); ++$request['attr'] = strtolower((string) get_request('attr','GET',false,'jpegphoto')); + $request['index'] = get_request('index','GET',false,0); + $request['type'] = get_request('type','GET',false,'image/jpeg'); + $request['filename'] = get_request('filename','GET',false,sprintf('%s.jpg',get_rdn($request['dn'],true))); diff --git a/net/phpldapadmin/files/patch-lib_AJAXTree.php b/net/phpldapadmin/files/patch-lib_AJAXTree.php new file mode 100644 --- /dev/null +++ b/net/phpldapadmin/files/patch-lib_AJAXTree.php @@ -0,0 +1,47 @@ +--- lib/AJAXTree.php.orig 2021-12-12 02:35:51 UTC ++++ lib/AJAXTree.php +@@ -31,7 +31,7 @@ class AJAXTree extends HTMLTree { + # Level pre-treatment + $code = ''; + if (is_string($level)) { +- for ($i=0; $i 0) + $code = '0' * $level; + +- $level = strlen($code); ++ $level = strlen((string) $code); + + # Get entry to display as node + $entry = $this->getEntry($item); +@@ -189,7 +189,7 @@ class AJAXTree extends HTMLTree { + + $indent = ''; + +- for ($i=0; $i',IMGDIR); +@@ -223,7 +223,7 @@ class AJAXTree extends HTMLTree { + if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) + debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs); + +- if (strlen($level) == 0) ++ if (strlen((string) $level) == 0) + return ''; + + $server = $this->getServer(); +@@ -243,7 +243,7 @@ class AJAXTree extends HTMLTree { + if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) + debug_log('Entered (%%)',33,0,__FILE__,__LINE__,__METHOD__,$fargs); + +- if (strlen($level) == 0) ++ if (strlen((string) $level) == 0) + return ''; + + $server = $this->getServer(); diff --git a/net/phpldapadmin/files/patch-lib_Attribute.php b/net/phpldapadmin/files/patch-lib_Attribute.php --- a/net/phpldapadmin/files/patch-lib_Attribute.php +++ b/net/phpldapadmin/files/patch-lib_Attribute.php @@ -1,11 +1,59 @@ --- lib/Attribute.php.orig 2021-12-12 02:35:51 UTC +++ lib/Attribute.php -@@ -12,7 +12,7 @@ - * @package phpLDAPadmin - * @subpackage Templates - */ --class Attribute { -+class PLAAttribute { - # Attribute Name - public $name; - # Source of this attribute definition +@@ -133,9 +133,9 @@ class PLAAttribute { + debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs,$this->name); + + if ($real) +- return $lower ? strtolower($this->name) : $this->name; ++ return $lower ? strtolower((string) $this->name) : $this->name; + else +- return $lower ? strtolower($this->real_attr_name()) : $this->real_attr_name(); ++ return $lower ? strtolower((string) $this->real_attr_name()) : $this->real_attr_name(); + } + + public function getValues() { +@@ -389,7 +389,7 @@ class PLAAttribute { + if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) + debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs); + +- $this->type = strtolower($type); ++ $this->type = strtolower((string) $type); + } + + public function getType() { +@@ -403,7 +403,7 @@ class PLAAttribute { + if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) + debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs); + +- $this->ldaptype = strtolower($type); ++ $this->ldaptype = strtolower((string) $type); + } + + public function getLDAPtype() { +@@ -671,7 +671,7 @@ class PLAAttribute { + + # Store our Aliases + foreach ($sattr->getAliases() as $alias) +- array_push($this->aliases,strtolower($alias)); ++ array_push($this->aliases,strtolower((string) $alias)); + + if ($sattr->getIsSingleValue()) + $this->setMaxValueCount(1); +@@ -840,7 +840,7 @@ class PLAAttribute { + 'type'=>'warn')); + } + +- elseif (is_string($values) && (strlen($values) > 0)) ++ elseif (is_string($values) && (strlen((string) $values) > 0)) + $this->values = array($values); + } + +@@ -877,7 +877,7 @@ class PLAAttribute { + if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) + debug_log('Entered (%%)',5,1,__FILE__,__LINE__,__METHOD__,$fargs,$this->name); + +- return preg_replace('/;.*$/U','',$this->name); ++ return preg_replace('/;.*$/U','',is_null($this->name)? "":$this->name); + } + + /** diff --git a/net/phpldapadmin/files/patch-lib_AttributeFactory.php b/net/phpldapadmin/files/patch-lib_AttributeFactory.php --- a/net/phpldapadmin/files/patch-lib_AttributeFactory.php +++ b/net/phpldapadmin/files/patch-lib_AttributeFactory.php @@ -1,11 +1,50 @@ --- lib/AttributeFactory.php.orig 2021-12-12 02:35:51 UTC +++ lib/AttributeFactory.php -@@ -133,7 +133,7 @@ class AttributeFactory { +@@ -83,7 +83,7 @@ class AttributeFactory { + if (isset($values['type'])) + switch ($values['type']) { + case 'password': +- if (! strcasecmp($name,'sambaLMPassword') || ! strcasecmp($name,'sambaNTPassword')) ++ if (! strcasecmp((string) $name,'sambaLMPassword') || ! strcasecmp((string) $name,'sambaNTPassword')) + return $this->newSambaPasswordAttribute($name,$values,$server_id,$source); + else + return $this->newPasswordAttribute($name,$values,$server_id,$source); +@@ -96,7 +96,7 @@ class AttributeFactory { + return $this->newMultiLineAttribute($name,$values,$server_id,$source); + } + +- if (! strcasecmp($name,'objectClass')) { ++ if (! strcasecmp((string) $name,'objectClass')) { + return $this->newObjectClassAttribute($name,$values,$server_id,$source); + + } elseif ($app['server']->isJpegPhoto($name) || in_array($name,$app['server']->getValue('server','jpeg_attributes'))) { +@@ -105,16 +105,16 @@ class AttributeFactory { + } elseif ($app['server']->isAttrBinary($name)) { + return $this->newBinaryAttribute($name,$values,$server_id,$source); + +- } elseif (! strcasecmp($name,'userPassword')) { ++ } elseif (! strcasecmp((string) $name,'userPassword')) { + return $this->newPasswordAttribute($name,$values,$server_id,$source); + +- } elseif (! strcasecmp($name,'sambaLMPassword') || ! strcasecmp($name,'sambaNTPassword')) { ++ } elseif (! strcasecmp((string) $name,'sambaLMPassword') || ! strcasecmp((string) $name,'sambaNTPassword')) { + return $this->newSambaPasswordAttribute($name,$values,$server_id,$source); + +- } elseif (in_array(strtolower($name),array_keys(array_change_key_case($_SESSION[APPCONFIG]->getValue('appearance','date_attrs'))))) { ++ } elseif (in_array(strtolower((string) $name),array_keys(array_change_key_case($_SESSION[APPCONFIG]->getValue('appearance','date_attrs'))))) { + return $this->newDateAttribute($name,$values,$server_id,$source); + +- } elseif (in_array(strtolower($name),array('shadowlastchange','shadowmin','shadowmax','shadowexpire','shadowwarning','shadowinactive'))) { ++ } elseif (in_array(strtolower((string) $name),array('shadowlastchange','shadowmin','shadowmax','shadowexpire','shadowwarning','shadowinactive'))) { + return $this->newShadowAttribute($name,$values,$server_id,$source); + + } elseif ($app['server']->isAttrBoolean($name)) { +@@ -129,7 +129,7 @@ class AttributeFactory { + } elseif ($app['server']->isMultiLineAttr($name)) { + return $this->newMultiLineAttribute($name,$values,$server_id,$source); + +- } elseif (! strcasecmp($name,'gidNumber')) { ++ } elseif (! strcasecmp((string) $name,'gidNumber')) { return $this->newGidAttribute($name,$values,$server_id,$source); } else { -- return new Attribute($name,$values,$server_id,$source); -+ return new PLAAttribute($name,$values,$server_id,$source); - } - } - diff --git a/net/phpldapadmin/files/patch-lib_HTMLTree.php b/net/phpldapadmin/files/patch-lib_HTMLTree.php new file mode 100644 --- /dev/null +++ b/net/phpldapadmin/files/patch-lib_HTMLTree.php @@ -0,0 +1,32 @@ +--- lib/HTMLTree.php.orig 2021-12-12 02:35:51 UTC ++++ lib/HTMLTree.php +@@ -168,9 +168,10 @@ class HTMLTree extends Tree { + printf(''; +@@ -361,7 +362,7 @@ class HTMLTree extends Tree { + $logged_in_dn_array = array(); + + } else { +- $logged_in_branch = preg_replace('/,'.$server->getContainerTop($logged_in_dn).'$/','',$logged_in_dn); ++ $logged_in_branch = preg_replace('/,'.$server->getContainerTop($logged_in_dn).'$/','',is_null($logged_in_dn)? "":$logged_in_dn); + $logged_in_dn_array = pla_explode_dn($logged_in_branch); + } + +@@ -375,7 +376,7 @@ class HTMLTree extends Tree { + if (! is_array($logged_in_dn_array)) + $logged_in_dn_array = array($logged_in_dn); + +- if (trim($logged_in_dn)) { ++ if (trim((string) $logged_in_dn)) { + if ($server->dnExists($logged_in_dn)) + foreach ($logged_in_dn_array as $rdn_piece) { + $href = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s',$server->getIndex(),rawurlencode($rdn)); diff --git a/net/phpldapadmin/files/patch-lib_PageRender.php b/net/phpldapadmin/files/patch-lib_PageRender.php --- a/net/phpldapadmin/files/patch-lib_PageRender.php +++ b/net/phpldapadmin/files/patch-lib_PageRender.php @@ -1,31 +1,120 @@ --- lib/PageRender.php.orig 2021-12-12 02:35:51 UTC +++ lib/PageRender.php -@@ -827,7 +827,7 @@ class PageRender extends Visitor { - if (! $attribute->getOldValue($i)) - return; +@@ -182,7 +182,7 @@ class PageRender extends Visitor { + $attribute2 = $this->template->getAttribute($joinattr); -- draw_jpeg_photo($this->getServer(),$this->template->getDN(),$attribute->getName(),$i,false,false); -+ draw_jpeg_photo($this->getServer(),$this->template->getDN(),$i,$attribute->getName(),false,false); - } + if (! $attribute2) { +- if (($pv = get_request(strtolower($joinattr),'REQUEST')) && isset($pv[$attribute->getName()][$i])) { ++ if (($pv = get_request(strtolower((string) $joinattr),'REQUEST')) && isset($pv[$attribute->getName()][$i])) { + array_push($values,$pv[$attribute->getName()][$i]); - /** -@@ -844,16 +844,16 @@ class PageRender extends Visitor { - # If the attribute is modified, the new value needs to be stored in a session variable for the draw_jpeg_photo callback. - if ($attribute->hasBeenModified()) { - $_SESSION['tmp'][$attribute->getName()][$i] = $attribute->getValue($i); -- draw_jpeg_photo(null,$this->template->getDN(),$attribute->getName(),$i,false,false); -+ draw_jpeg_photo(null,$this->template->getDN(),$i,$attribute->getName(),false,false); - } else -- draw_jpeg_photo($this->getServer(),$this->template->getDN(),$attribute->getName(),$i,false,false); -+ draw_jpeg_photo($this->getServer(),$this->template->getDN(),$i,$attribute->getName(),false,false); - } + if (! $pv[$attribute->getName()][$i]) +@@ -242,7 +242,7 @@ class PageRender extends Visitor { + return; + + # Get the attribute. +- if (preg_match_all('/%(\w+)(\|.+)?(\/[lU])?%/U',strtolower($args[1]),$matchall)) { ++ if (preg_match_all('/%(\w+)(\|.+)?(\/[lU])?%/U',strtolower((string) $args[1]),$matchall)) { + if (count($matchall[1]) != 1) + system_message(array( + 'title'=>_('Invalid value count for PasswordEncrypt'), +@@ -255,11 +255,11 @@ class PageRender extends Visitor { + } else + $passwordvalue = $args[1]; + +- if (! trim($passwordvalue) || in_array($passwordvalue,$attribute->getOldValues())) ++ if (! trim((string) $passwordvalue) || in_array($passwordvalue,$attribute->getOldValues())) + return; + + # Get the encoding +- if ($passwordattr && preg_match_all('/%(\w+)(\|.+)?(\/[lU])?%/U',strtolower($args[0]),$matchall)) { ++ if ($passwordattr && preg_match_all('/%(\w+)(\|.+)?(\/[lU])?%/U',strtolower((string) $args[0]),$matchall)) { + if (count($matchall[1]) != 1) + system_message(array( + 'title'=>_('Invalid value count for PasswordEncrypt'), +@@ -271,7 +271,7 @@ class PageRender extends Visitor { + } else + $enc = $args[0]; + +- $enc = strtolower($enc); ++ $enc = strtolower((string) $enc); + + switch ($enc) { + case 'lm': +@@ -403,7 +403,7 @@ class PageRender extends Visitor { + $alias_note = $this->get($note,$attribute); + + if ($alias_note) { +- if (trim($attr_note)) ++ if (trim((string) $attr_note)) + $attr_note .= ', '; + + $attr_note .= $alias_note; +@@ -423,7 +423,7 @@ class PageRender extends Visitor { + # Is there a user-friendly translation available for this attribute? + $friendly_name = $attribute->getFriendlyName(); - protected function drawFormReadOnlyValueJpegAttribute($attribute,$i) { - $this->draw('HiddenValue',$attribute,$i); - $_SESSION['tmp'][$attribute->getName()][$i] = $attribute->getValue($i); +- if (strtolower($friendly_name) != $attribute->getName()) ++ if (strtolower((string) $friendly_name) != $attribute->getName()) + return sprintf('%s', + _('Note'),$friendly_name,_('is an alias for'),$attribute->getName(false),_('alias')); + else +@@ -954,7 +954,7 @@ class PageRender extends Visitor { + $server = $this->getServer(); + $val = $attribute->getValue($i); -- draw_jpeg_photo(null,$this->template->getDN(),$attribute->getName(),$i,false,false); -+ draw_jpeg_photo(null,$this->template->getDN(),$i,$attribute->getName(),false,false); +- if (trim($val)) ++ if (trim((string) $val)) + $enc_type = get_enc_type($val); + else + $enc_type = $server->getValue('appearance','pla_password_hash'); +@@ -966,7 +966,7 @@ class PageRender extends Visitor { + htmlspecialchars($attribute->getName()),$i,htmlspecialchars($attribute->getName()), + $i,htmlspecialchars($val),($attribute->getSize() > 0) ? 'size="'.$attribute->getSize().'"' : ''); + +- if (trim($val)) ++ if (trim((string) $val)) + $this->draw('CheckLink',$attribute,'new_values_'.htmlspecialchars($attribute->getName()).'_'.$i); } - protected function drawFormReadOnlyValueMultiLineAttribute($attribute,$i) { +@@ -979,7 +979,7 @@ class PageRender extends Visitor { + $enc_type = get_enc_type($val); + + # Set the default hashing type if the password is blank (must be newly created) +- if (trim($val)) ++ if (trim((string) $val)) + $enc_type = get_enc_type($val); + else + $enc_type = $server->getValue('appearance','pla_password_hash'); +@@ -1125,7 +1125,7 @@ class PageRender extends Visitor { + + foreach ($attribute->getSelection() as $value => $description) { + printf('',$value, +- ((strcasecmp($value,$val) == 0) && $found = true) ? 'selected="selected"' : '',$description); ++ ((strcasecmp((string) $value,(string) $val) == 0) && (string) $found = true) ? 'selected="selected"' : '',(string) $description); + + if ($value == '') + $empty_value = true; +@@ -1140,7 +1140,7 @@ class PageRender extends Visitor { + echo "\n"; + } + +- if ((strlen($val) > 0) && ! $empty_value && $this->template->getDN()) { ++ if ((strlen((string) $val) > 0) && ! $empty_value && $this->template->getDN()) { + printf('',_('none, remove value')); + echo "\n"; + } +@@ -1212,11 +1212,11 @@ class PageRender extends Visitor { + $today = date('U'); + + echo '
'; +- if (($today < $shadow_date) && in_array(strtolower($attribute->getName()),$shadow_before_today_attrs)) ++ if (($today < $shadow_date) && in_array(strtolower((string) $attribute->getName()),$shadow_before_today_attrs)) + printf('(%s)', + strftime($_SESSION[APPCONFIG]->getValue('appearance','date'),$shadow_date)); + +- elseif (($today > $shadow_date) && in_array(strtolower($attribute->getName()),$shadow_after_today_attrs)) ++ elseif (($today > $shadow_date) && in_array(strtolower((string) $attribute->getName()),$shadow_after_today_attrs)) + printf('(%s)', + strftime($_SESSION[APPCONFIG]->getValue('appearance','date'),$shadow_date)); + diff --git a/net/phpldapadmin/files/patch-lib_Query.php b/net/phpldapadmin/files/patch-lib_Query.php new file mode 100644 --- /dev/null +++ b/net/phpldapadmin/files/patch-lib_Query.php @@ -0,0 +1,68 @@ +--- lib/Query.php.orig 2021-12-12 02:35:51 UTC ++++ lib/Query.php +@@ -87,9 +87,9 @@ class Query extends xmlTemplate { + if (in_array($xml_key,$storelower)) + if (is_array($xml_value)) + foreach ($xml_value as $index => $value) +- $xml_value[$index] = strtolower($value); ++ $xml_value[$index] = strtolower((string) $value); + else +- $xml_value = strtolower($xml_value); ++ $xml_value = strtolower((string) $xml_value); + + # Items that must be stored as arrays + if (in_array($xml_key,$storearray) && ! is_array($xml_value)) +@@ -109,7 +109,7 @@ class Query extends xmlTemplate { + # Check we have some manditory items. + foreach (array() as $key) { + if (! isset($this->$key) +- || (! is_array($this->$key) && ! trim($this->$key))) { ++ || (! is_array($this->$key) && ! trim((string) $this->$key))) { + + $this->setInvalid(sprintf(_('Missing %s in the XML file.'),$key)); + break; +@@ -138,7 +138,7 @@ class Query extends xmlTemplate { + $query['scope'] = get_request('scope','REQUEST',false,'sub'); + $attrs = get_request('display_attrs','REQUEST'); + +- $attrs = preg_replace('/\s+/','',$attrs); ++ $attrs = preg_replace('/\s+/','',is_null($attrs)? "":$attrs); + if ($attrs) + $query['attrs'] = explode(',',$attrs); + else +@@ -198,9 +198,9 @@ class Query extends xmlTemplate { + public function getDNEncode($url=true) { + // @todo Be nice to do all this in 1 location + if ($url) +- return urlencode(preg_replace('/%([0-9a-fA-F]+)/',"%25\\1",$this->dn)); ++ return urlencode(preg_replace('/%([0-9a-fA-F]+)/',"%25\\1",is_null($this->dn)? "":$this->dn)); + else +- return preg_replace('/%([0-9a-fA-F]+)/',"%25\\1",$this->dn); ++ return preg_replace('/%([0-9a-fA-F]+)/',"%25\\1",is_null($this->dn)? "":$this->dn); + } + + public function getAttrSortOrder() { +@@ -216,9 +216,9 @@ class Query extends xmlTemplate { + array_push($result,$attribute->getName()); + + } else { +- $display = preg_replace('/,\s+/',',',get_request('orderby','REQUEST',false,'dn')); ++ $display = preg_replace('/,\s+/',',',get_request('orderby','REQUEST',false,is_null('dn')? "":'dn')); + +- if (trim($display)) ++ if (trim((string) $display)) + $result = explode(',',$display); + } + +@@ -238,9 +238,9 @@ class Query extends xmlTemplate { + array_push($result,$attribute->getName()); + + } else { +- $display = preg_replace('/,\s+/',',',get_request('display_attrs','REQUEST',false,'')); ++ $display = preg_replace('/,\s+/',',',get_request('display_attrs','REQUEST',false,is_null('')? "":'')); + +- if (trim($display)) ++ if (trim((string) $display)) + $result = explode(',',$display); + } + diff --git a/net/phpldapadmin/files/patch-lib_QueryRender.php b/net/phpldapadmin/files/patch-lib_QueryRender.php new file mode 100644 --- /dev/null +++ b/net/phpldapadmin/files/patch-lib_QueryRender.php @@ -0,0 +1,38 @@ +--- lib/QueryRender.php.orig 2021-12-12 02:35:51 UTC ++++ lib/QueryRender.php +@@ -280,7 +280,7 @@ class QueryRender extends PageRender { + + # Iterate over each attribute for this entry + foreach (explode(',',$ado) as $attr) { +- $attr = strtolower($attr); ++ $attr = strtolower((string) $attr); + + # Ignore DN, we've already displayed it. + if ($attr == 'dn') +@@ -379,7 +379,7 @@ class QueryRender extends PageRender { + + # Special case for DNs + if ($attr == 'dn') { +- $dn_display = strlen($dndetails['dn']) > 40 ++ $dn_display = strlen((string) $dndetails['dn']) > 40 + ? sprintf('%s...',htmlspecialchars($dndetails['dn']),htmlspecialchars(substr($dndetails['dn'],0,40))) + : htmlspecialchars($dndetails['dn']); + +@@ -461,7 +461,7 @@ class QueryRender extends PageRender { + $results = array(); + + foreach (explode(',',$this->template->getAttrDisplayOrder()) as $attr) +- $results[strtolower($attr)] = $attribute_factory->newAttribute($attr,array('values'=>array()),$this->getServerID()); ++ $results[strtolower((string) $attr)] = $attribute_factory->newAttribute($attr,array('values'=>array()),$this->getServerID()); + + return $results; + } +@@ -470,7 +470,7 @@ class QueryRender extends PageRender { + if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) + debug_log('Entered (%%)',129,0,__FILE__,__LINE__,__METHOD__,$fargs); + +- return preg_replace('/=/','.',base64_encode($dn)); ++ return preg_replace('/=/','.',is_null(base64_encode($dn)? "":base64_encode($dn)); + } + + private function drawBaseTabs() { diff --git a/net/phpldapadmin/files/patch-lib_Template.php b/net/phpldapadmin/files/patch-lib_Template.php new file mode 100644 --- /dev/null +++ b/net/phpldapadmin/files/patch-lib_Template.php @@ -0,0 +1,248 @@ +--- lib/Template.php.orig 2021-12-12 02:35:51 UTC ++++ lib/Template.php +@@ -100,7 +100,7 @@ class Template extends xmlTemplate { + foreach ($xmldata['template'][$xml_key]['objectclass'] as $index => $details) { + + # XML files with only 1 objectClass dont have a numeric index. +- $soc = $server->getSchemaObjectClass(strtolower($details)); ++ $soc = $server->getSchemaObjectClass(strtolower((string) $details)); + + # If we havent recorded this objectclass already, do so now. + if (is_object($soc) && ! in_array($soc->getName(),$objectclasses)) +@@ -115,7 +115,7 @@ class Template extends xmlTemplate { + + } else { + # XML files with only 1 objectClass dont have a numeric index. +- $soc = $server->getSchemaObjectClass(strtolower($xmldata['template'][$xml_key]['objectclass'])); ++ $soc = $server->getSchemaObjectClass(strtolower((string) $xmldata['template'][$xml_key]['objectclass'])); + + # If we havent recorded this objectclass already, do so now. + if (is_object($soc) && ! in_array($soc->getName(),$objectclasses)) +@@ -160,9 +160,9 @@ class Template extends xmlTemplate { + if (in_array($xml_key,$storelower)) + if (is_array($xml_value)) + foreach ($xml_value as $index => $value) +- $xml_value[$index] = strtolower($value); ++ $xml_value[$index] = strtolower((string) $value); + else +- $xml_value = strtolower($xml_value); ++ $xml_value = strtolower((string) $xml_value); + + # Items that must be stored as arrays + if (in_array($xml_key,$storearray) && ! is_array($xml_value)) +@@ -198,7 +198,7 @@ class Template extends xmlTemplate { + # Check we have some manditory items. + foreach (array('rdn','structural_oclass','visible') as $key) { + if (! isset($this->$key) +- || (! is_array($this->$key) && ! trim($this->$key))) { ++ || (! is_array($this->$key) && ! trim((string) $this->$key))) { + + $this->setInvalid(sprintf(_('Missing %s in the XML file.'),$key)); + break; +@@ -272,7 +272,7 @@ class Template extends xmlTemplate { + 'body'=>sprintf('DN (%s) didnt exist in LDAP?',$this->dn), + 'type'=>'info')); + +- $rdnarray = rdn_explode(strtolower(get_rdn(dn_escape($this->dn)))); ++ $rdnarray = rdn_explode(strtolower((string) get_rdn(dn_escape($this->dn)))); + + $counter = 1; + foreach ($server->getDNAttrValues($this->dn,null,LDAP_DEREF_NEVER,array_merge(array('*'),$server->getValue('server','custom_attrs')),$nocache) as $attr => $values) { +@@ -298,7 +298,7 @@ class Template extends xmlTemplate { + # Work out the RDN attributes + foreach ($attribute->getValues() as $index => $value) + if (in_array(sprintf('%s=%s', +- $attribute->getName(),strtolower($attribute->getValue($index))),$rdnarray)) ++ $attribute->getName(),strtolower((string) $attribute->getValue($index))),$rdnarray)) + $attribute->setRDN($counter++); + + if ($makeVisible) +@@ -355,7 +355,7 @@ class Template extends xmlTemplate { + + # Prune out entries with a blank value. + foreach ($values as $index => $value) +- if (! strlen(trim($value))) ++ if (! strlen((string) trim((string) $value))) + unset($values[$index]); + + $attribute = $this->getAttribute($attr); +@@ -603,7 +603,7 @@ class Template extends xmlTemplate { + foreach ($rdnarray as $index => $rdnattr) { + list($attr,$value) = explode('=',$rdnattr); + +- if (strtolower($attr) == $attribute->getName()) { ++ if (strtolower((string) $attr) == $attribute->getName()) { + $attribute->setRDN($counter++); + unset($rdnarray[$index]); + } +@@ -637,9 +637,9 @@ class Template extends xmlTemplate { + public function getDNEncode($url=true) { + // @todo Be nice to do all this in 1 location + if ($url) +- return urlencode(preg_replace('/%([0-9a-fA-F]+)/',"%25\\1",$this->getDN())); ++ return urlencode(preg_replace('/%([0-9a-fA-F]+)/',"%25\\1",is_null($this->getDN())? "":$this->getDN())); + else +- return preg_replace('/%([0-9a-fA-F]+)/',"%25\\1",$this->getDN()); ++ return preg_replace('/%([0-9a-fA-F]+)/',"%25\\1",is_null($this->getDN())? "":$this->getDN()); + } + + /** +@@ -676,9 +676,9 @@ class Template extends xmlTemplate { + public function getContainerEncode($url=true) { + // @todo Be nice to do all this in 1 location + if ($url) +- return urlencode(preg_replace('/%([0-9a-fA-F]+)/',"%25\\1",$this->container)); ++ return urlencode(preg_replace('/%([0-9a-fA-F]+)/',"%25\\1",is_null($this->container)? "":$this->container)); + else +- return preg_replace('/%([0-9a-fA-F]+)/',"%25\\1",$this->container); ++ return preg_replace('/%([0-9a-fA-F]+)/',"%25\\1",is_null($this->container)? "":$this->container); + } + + /** +@@ -707,7 +707,7 @@ class Template extends xmlTemplate { + $modified = false; + foreach ($rdnarray as $index => $rdnattr) { + list($attr,$value) = explode('=',$rdnattr); +- if (strtolower($attr) == $attribute->getName()) { ++ if (strtolower((string) $attr) == $attribute->getName()) { + + # If this is already marked as an RDN, then this multivalue RDN was updated on a previous loop + if (! $modified) { +@@ -726,7 +726,7 @@ class Template extends xmlTemplate { + } + + // @todo If this is a Jpeg Attribute, we need to mark it read only, since it cant be deleted like text attributes can +- if (strcasecmp(get_class($attribute),'jpegAttribute') == 0) ++ if (strcasecmp(get_class((string) $attribute),'jpegAttribute') == 0) + $attribute->setReadOnly(); + } + +@@ -761,7 +761,7 @@ class Template extends xmlTemplate { + $result = array(); + + foreach ($this->attributes as $index => $attribute) { +- if ($attribute->getLDAPtype() == strtolower($type)) ++ if ($attribute->getLDAPtype() == strtolower((string) $type)) + array_push($result,$attribute->getName()); + } + +@@ -775,7 +775,7 @@ class Template extends xmlTemplate { + if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) + debug_log('Entered (%%)',5,0,__FILE__,__LINE__,__METHOD__,$fargs); + +- if (in_array(strtolower($attr),$this->getAttrbyLdapType($type))) ++ if (in_array(strtolower((string) $attr),$this->getAttrbyLdapType($type))) + return true; + else + return false; +@@ -856,7 +856,7 @@ class Template extends xmlTemplate { + } + + # Chop the last plus sign off when returning +- return preg_replace('/\+$/','',$rdn); ++ return preg_replace('/\+$/','',is_null($rdn)? "":$rdn); + } + + /** +@@ -1166,25 +1166,25 @@ class Template extends xmlTemplate { + $attribute->js['autoFill'] = ''; + + $formula = $string; +- $formula = preg_replace('/^([^%])/','\'$1',$formula); +- $formula = preg_replace('/([^%])$/','$1\'',$formula); ++ $formula = preg_replace('/^([^%])/','\'$1',is_null($formula)? "":$formula); ++ $formula = preg_replace('/([^%])$/','$1\'',is_null($formula)? "":$formula); + + # Check that our attributes match our schema attributes. + foreach ($matchall[1] as $index => $checkattr) { + $sattr = $this->getServer()->getSchemaAttribute($checkattr); + + # If the attribute is the same as in the XML file, then dont need to do anything. +- if (! $sattr || ! strcasecmp($sattr->getName(),$checkattr)) ++ if (! (string) $sattr || ! strcasecmp((string) $sattr->getName(),(string) $checkattr)) + continue; + +- $formula = preg_replace("/$checkattr/",$sattr->getName(),$formula); ++ $formula = preg_replace("/$checkattr/",$sattr->getName(),is_null($formula)? "":$formula); + $matchall[1][$index] = $sattr->getName(); + } + + $elem_id = 0; + + foreach ($matchall[0] as $index => $null) { +- $match_attr = strtolower($matchall[1][$index]); ++ $match_attr = strtolower((string) $matchall[1][$index]); + $match_subst = $matchall[2][$index]; + $match_mod = $matchall[3][$index]; + $match_delim = $matchall[4][$index]; +@@ -1199,7 +1199,7 @@ class Template extends xmlTemplate { + $js_match_attr = $match_attr; + $match_attr = $js_match_attr.'xx'.$varcount[$match_attr]; + +- $formula = preg_replace('/%'.$js_match_attr.'([|\/%])/i','%'.$match_attr.'$1',$formula,1); ++ $formula = preg_replace('/%'.$js_match_attr.'([|\/%])/i','%'.$match_attr.'$1',$formula,is_null(1)? "":1); + + $attribute->js['autoFill'] .= sprintf(" var %s;\n",$match_attr); + $attribute->js['autoFill'] .= sprintf( +@@ -1216,7 +1216,7 @@ class Template extends xmlTemplate { + $elem_id++; + + if (strstr($match_mod,'k')) { +- preg_match_all('/([0-9]+)/',trim($match_subst),$substrarray); ++ preg_match_all('/([0-9]+)/',trim((string) $match_subst),$substrarray); + if (isset($substrarray[1][0])) { + $tok_idx = $substrarray[1][0]; + } else { +@@ -1225,7 +1225,7 @@ class Template extends xmlTemplate { + $attribute->js['autoFill'] .= sprintf(" %s = %s.split(':')[%s];\n",$match_attr,$match_attr,$tok_idx); + + } elseif (strstr($match_mod,'K')) { +- preg_match_all('/([0-9]+)/',trim($match_subst),$substrarray); ++ preg_match_all('/([0-9]+)/',trim((string) $match_subst),$substrarray); + if (isset($substrarray[1][0])) { + $tok_idx = $substrarray[1][0]; + } else { +@@ -1240,7 +1240,7 @@ class Template extends xmlTemplate { + $attribute->js['autoFill'] .= sprintf(" %s = %s.split('%s')[%s];\n",$match_attr,$match_attr,$delimiter,$tok_idx); + + } else { +- preg_match_all('/([0-9]*)-([0-9]*)/',trim($match_subst),$substrarray); ++ preg_match_all('/([0-9]*)-([0-9]*)/',trim((string) $match_subst),$substrarray); + if ((isset($substrarray[1][0]) && $substrarray[1][0]) || (isset($substrarray[2][0]) && $substrarray[2][0])) { + $attribute->js['autoFill'] .= sprintf(" %s = %s.substr(%s,%s);\n", + $match_attr,$match_attr, +@@ -1260,19 +1260,19 @@ class Template extends xmlTemplate { + } + + # Matchfor only entry without modifiers. +- $formula = preg_replace('/^%('.$match_attr.')%$/U','$1 + \'\'',$formula); ++ $formula = preg_replace('/^%('.$match_attr.')%$/U','$1 + \'\'',is_null($formula)? "":$formula); + # Matchfor only entry with modifiers. +- $formula = preg_replace('/^%('.$match_attr.')(\|[0-9]*-[0-9]*)?(\/[KklTUA]+)?(?:\|(.))?%$/U','$1 + \'\'',$formula); ++ $formula = preg_replace('/^%('.$match_attr.')(\|[0-9]*-[0-9]*)?(\/[KklTUA]+)?(?:\|(.))?%$/U','$1 + \'\'',is_null($formula)? "":$formula); + # Matchfor begining entry. +- $formula = preg_replace('/^%('.$match_attr.')(\|[0-9]*-[0-9]*)?(\/[KklTUA]+)?(?:\|(.))?%/U','$1 + \'',$formula); ++ $formula = preg_replace('/^%('.$match_attr.')(\|[0-9]*-[0-9]*)?(\/[KklTUA]+)?(?:\|(.))?%/U','$1 + \'',is_null($formula)? "":$formula); + # Matchfor ending entry. +- $formula = preg_replace('/%('.$match_attr.')(\|[0-9]*-[0-9]*)?(\/[KklTUA]+)?(?:\|(.))?%$/U','\' + $1 ',$formula); ++ $formula = preg_replace('/%('.$match_attr.')(\|[0-9]*-[0-9]*)?(\/[KklTUA]+)?(?:\|(.))?%$/U','\' + $1 ',is_null($formula)? "":$formula); + # Match for entries not at begin/end. +- $formula = preg_replace('/%('.$match_attr.')(\|[0-9]*-[0-9]*)?(\/[KklTUA]+)?(?:\|(.))?%/U','\' + $1 + \'',$formula); ++ $formula = preg_replace('/%('.$match_attr.')(\|[0-9]*-[0-9]*)?(\/[KklTUA]+)?(?:\|(.))?%/U','\' + $1 + \'',is_null($formula)? "":$formula); + $attribute->js['autoFill'] .= "\n"; + } + +- $attribute->js['autoFill'] .= sprintf(" fillRec(pre+'%s'+suf, %s); // %s\n",strtolower($attr),$formula,$string); ++ $attribute->js['autoFill'] .= sprintf(" fillRec(pre+'%s'+suf, %s); // %s\n",strtolower((string) $attr),$formula,$string); + $attribute->js['autoFill'] .= "\n"; + break; + +@@ -1333,7 +1333,7 @@ class Template extends xmlTemplate { + $this->setMinValueCount($sattr->getName(),1); + + # We need to mark the attributes as show, except for the objectclass attribute. +- if (strcasecmp('objectClass',$objectclassattr) != 0) { ++ if (strcasecmp('objectClass',(string) $objectclassattr) != 0) { + $attribute = $this->getAttribute($sattr->getName()); + $attribute->show(); + } diff --git a/net/phpldapadmin/files/patch-lib_TemplateRender.php b/net/phpldapadmin/files/patch-lib_TemplateRender.php new file mode 100644 --- /dev/null +++ b/net/phpldapadmin/files/patch-lib_TemplateRender.php @@ -0,0 +1,99 @@ +--- lib/TemplateRender.php.orig 2021-12-12 02:35:51 UTC ++++ lib/TemplateRender.php +@@ -291,8 +291,8 @@ class TemplateRender extends PageRender { + $formvalues = array_change_key_case($_REQUEST['form']); + + foreach ($filtermatchall[1] as $arg) { +- $value = $formvalues[strtolower($arg)]; +- $args[1] = preg_replace("/%($arg)(\|.+)?(\/[lU])?%/U",$value,$args[1]); ++ $value = $formvalues[strtolower((string) $arg)]; ++ $args[1] = preg_replace("/%($arg)(\|.+)?(\/[lU])?%/U",$value,is_null($args[1])? "":$args[1]); + } + } + +@@ -323,7 +323,7 @@ class TemplateRender extends PageRender { + $fixedvalue = preg_split('/=\>/',$fixedvalue); + $displayvalue = explode('=',$fixedvalue[1]); + +- $newvalue[trim($fixedvalue[0])] = array($args[2]=>trim($fixedvalue[0]),trim($displayvalue[0])=>trim($displayvalue[1])); ++ $newvalue[trim((string) $fixedvalue[0])] = array($args[2]=>trim((string) $fixedvalue[0]),trim((string) $displayvalue[0])=>trim((string) $displayvalue[1])); + + $picklistvalues = array_merge($picklistvalues,$newvalue); + } +@@ -353,7 +353,7 @@ class TemplateRender extends PageRender { + if (function_exists('mb_convert_case')) + $disp_val = mb_convert_case($disp_val,MB_CASE_LOWER,'utf-8'); + else +- $disp_val = strtolower($disp_val); ++ $disp_val = strtolower((string) $disp_val); + + break; + +@@ -380,11 +380,11 @@ class TemplateRender extends PageRender { + } + + # make value a substring of +- preg_match_all('/^\|([0-9]*)-([0-9]*)$/',trim($matchall[2][$key]),$substrarray); ++ preg_match_all('/^\|([0-9]*)-([0-9]*)$/',trim((string) $matchall[2][$key]),$substrarray); + + if ((isset($substrarray[1][0]) && $substrarray[1][0]) || (isset($substrarray[2][0]) && $substrarray[2][0])) { + $begin = $substrarray[1][0] ? $substrarray[1][0] : '0'; +- $end = $substrarray[2][0] ? $substrarray[2][0] : strlen($disp_val); ++ $end = $substrarray[2][0] ? $substrarray[2][0] : strlen((string) $disp_val); + + if (function_exists('mb_substr')) + $disp_val = mb_substr($disp_val,$begin,$end,'utf-8'); +@@ -392,7 +392,7 @@ class TemplateRender extends PageRender { + $disp_val = substr($disp_val,$begin,$end); + } + +- $display = preg_replace("/%($arg)(\|.+)?(\/[lUC])?%/U",$disp_val,$display); ++ $display = preg_replace("/%($arg)(\|.+)?(\/[lUC])?%/U",$disp_val,is_null($display)? "":$display); + } + + if (! isset($picklist[$values[$args[2]]])) { +@@ -1347,7 +1347,7 @@ class TemplateRender extends PageRender { + echo '
%s
'; diff --git a/net/phpldapadmin/files/patch-htdocs_purge__cache.php b/net/phpldapadmin/files/patch-htdocs_purge__cache.php new file mode 100644 --- /dev/null +++ b/net/phpldapadmin/files/patch-htdocs_purge__cache.php @@ -0,0 +1,11 @@ +--- htdocs/purge_cache.php.orig 2021-12-12 02:35:51 UTC ++++ htdocs/purge_cache.php +@@ -16,7 +16,7 @@ $purge_session_keys = array('app_initialized','backtra + $size = 0; + foreach ($purge_session_keys as $key) + if (isset($_SESSION[$key])) { +- $size += strlen(serialize($_SESSION[$key])); ++ $size += strlen((string) serialize($_SESSION[$key])); + unset($_SESSION[$key]); + } + diff --git a/net/phpldapadmin/files/patch-htdocs_schema.php b/net/phpldapadmin/files/patch-htdocs_schema.php new file mode 100644 --- /dev/null +++ b/net/phpldapadmin/files/patch-htdocs_schema.php @@ -0,0 +1,165 @@ +--- htdocs/schema.php.orig 2021-12-12 02:35:51 UTC ++++ htdocs/schema.php +@@ -25,7 +25,7 @@ $entry['value'] = get_request('viewvalue','GET'); + + if (! is_null($entry['value'])) { + $entry['viewed'] = false; +- $entry['value'] = strtolower($entry['value']); ++ $entry['value'] = strtolower((string) $entry['value']); + } + + $schema_error_str = sprintf('%s %s.

%s
  • %s
  • %s
  • %s
  • %s
', +@@ -149,12 +149,12 @@ switch($entry['view']) { + echo '
'; + + foreach ($sattrs as $attr) { +- if (isAjaxEnabled() || (is_null($entry['value']) || ! trim($entry['value']) || $entry['value']==$attr->getName())) { +- if ((! is_null($entry['value']) && $entry['value']==$attr->getName()) || ! trim($entry['value'])) ++ if (isAjaxEnabled() || (is_null($entry['value']) || ! trim((string) $entry['value']) || $entry['value']==$attr->getName())) { ++ if ((! is_null($entry['value']) && $entry['value']==$attr->getName()) || ! trim((string) $entry['value'])) + $entry['viewed'] = true; + + if (isAjaxEnabled() && $entry['value']) +- printf('
',$attr->getName(),strcasecmp($entry['value'],$attr->getName()) ? 'none' : 'block'); ++ printf('
',(string) $attr->getName(),strcasecmp((string) $entry['value'],(string) $attr->getName()) ? 'none' : 'block'); + else + printf('
',$attr->getName()); + +@@ -193,10 +193,10 @@ switch($entry['view']) { + printf('(%s)',_('none')); + + else { +- $href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['attributes'],strtolower($attr->getSupAttribute()))); ++ $href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['attributes'],strtolower((string) $attr->getSupAttribute()))); + if (isAjaxEnabled()) + printf('%s', +- $href,strtolower($attr->getSupAttribute()),$attr->getSupAttribute()); ++ $href,strtolower((string) $attr->getSupAttribute()),$attr->getSupAttribute()); + else + printf('%s',$href,$attr->getSupAttribute()); + } +@@ -287,10 +287,10 @@ switch($entry['view']) { + + else + foreach ($attr->getAliases() as $alias) { +- $href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['attributes'],strtolower($alias))); ++ $href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['attributes'],strtolower((string) $alias))); + if (isAjaxEnabled()) + printf('%s', +- $href,strtolower($alias),$alias); ++ $href,strtolower((string) $alias),$alias); + else + printf('%s',$href,$alias); + } +@@ -306,10 +306,10 @@ switch($entry['view']) { + + else + foreach ($attr->getUsedInObjectClasses() as $objectclass) { +- $href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower($objectclass))); ++ $href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower((string) $objectclass))); + if (isAjaxEnabled()) + printf('%s ', +- $href,$href,_('ObjectClasses'),strtolower($objectclass),$objectclass); ++ $href,$href,_('ObjectClasses'),strtolower((string) $objectclass),$objectclass); + else + printf('%s ',$href,$objectclass); + } +@@ -379,8 +379,8 @@ switch($entry['view']) { + $oid = $rule->getOID(); + $desc = $rule->getName(false); + +- if (isAjaxEnabled() || (is_null($entry['value']) || ! trim($entry['value']) || $entry['value']==$rule->getName())) { +- if ((! is_null($entry['value']) && $entry['value']==$rule->getName()) || ! trim($entry['value'])) ++ if (isAjaxEnabled() || (is_null($entry['value']) || ! trim((string) $entry['value']) || $entry['value']==$rule->getName())) { ++ if ((! is_null($entry['value']) && $entry['value']==$rule->getName()) || ! trim((string) $entry['value'])) + $entry['viewed'] = true; + + if (null != $rule->getDescription()) +@@ -391,7 +391,7 @@ switch($entry['view']) { + + if (isAjaxEnabled() && $entry['value']) + printf('
%s
%s: ',_('Parent to')); +- if (strcasecmp($oclass->getName(),'top') == 0) { ++ if (strcasecmp((string) $oclass->getName(),'top') == 0) { + $href = htmlspecialchars($entry['href']['objectclasses']); + if (isAjaxEnabled()) + printf('all', +@@ -521,10 +521,10 @@ switch($entry['view']) { + + else + foreach ($oclass->getChildObjectClasses() as $i => $object_class) { +- $href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower($object_class))); ++ $href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower((string) $object_class))); + if (isAjaxEnabled()) + printf('%s', +- $href,_('Jump to this objectClass definition'),strtolower($object_class),$object_class); ++ $href,_('Jump to this objectClass definition'),strtolower((string) $object_class),$object_class); + else + printf('%s',$href,_('Jump to this objectClass definition'),$object_class); + +@@ -553,11 +553,11 @@ switch($entry['view']) { + + if ($attr->getSource() != $oclass->getName(false)) { + echo '
'; +- $href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower($attr->getSource()))); ++ $href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower((string) $attr->getSource()))); + printf('(%s ',_('Inherited from')); + if (isAjaxEnabled()) + printf('%s', +- $href,_('Jump to this objectClass definition'),strtolower($attr->getSource()),$attr->getSource()); ++ $href,_('Jump to this objectClass definition'),strtolower((string) $attr->getSource()),$attr->getSource()); + else + printf('%s',$href,$attr->getSource()); + echo ')'; +@@ -586,11 +586,11 @@ switch($entry['view']) { + + if ($attr->getSource() != $oclass->getName(false)) { + echo '
'; +- $href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower($attr->getSource()))); ++ $href = htmlspecialchars(sprintf('%s&viewvalue=%s',$entry['href']['objectclasses'],strtolower((string) $attr->getSource()))); + printf('(%s ',_('Inherited from')); + if (isAjaxEnabled()) + printf('%s', +- $href,_('Jump to this objectClass definition'),strtolower($attr->getSource()),$attr->getSource()); ++ $href,_('Jump to this objectClass definition'),strtolower((string) $attr->getSource()),$attr->getSource()); + else + printf('%s',$href,$attr->getSource()); + echo ')'; diff --git a/net/phpldapadmin/files/patch-htdocs_server__info.php b/net/phpldapadmin/files/patch-htdocs_server__info.php new file mode 100644 --- /dev/null +++ b/net/phpldapadmin/files/patch-htdocs_server__info.php @@ -0,0 +1,20 @@ +--- htdocs/server_info.php.orig 2021-12-12 02:35:51 UTC ++++ htdocs/server_info.php +@@ -60,7 +60,7 @@ foreach ($attrs as $key => $values) { + printf('
%s%s
%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(' %s',IMGDIR,$m,'Timeout'); + } + echo '
'; +@@ -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; $iencryptBlock($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; $idecryptBlock(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: - * -- * 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); - * - * - * @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('%s',$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;