diff --git a/lib/HTMLTree.php b/lib/HTMLTree.php index e5fbf3b7..318f68ab 100644 --- a/lib/HTMLTree.php +++ b/lib/HTMLTree.php @@ -98,7 +98,8 @@ public function draw($onlytree=false) { $this->javascript .= '
'; $this->javascript .= ''; $this->javascript .= sprintf('',$server->getIndex()); - $this->javascript .= sprintf('',htmlspecialchars($server->getContainer($base->getDN()))); + $t = $server->getContainer($base->getDN()); + $this->javascript .= sprintf('',htmlspecialchars(is_null($t)? '': $t)); $this->javascript .= sprintf('',get_rdn($base->getDN())); $this->javascript .= sprintf('',$rdn[0]); $this->javascript .= sprintf('',$rdn[0],$rdn[1]); diff --git a/lib/PLAAttribute.php b/lib/PLAAttribute.php index a2f0091c..dfcc8e60 100644 --- a/lib/PLAAttribute.php +++ b/lib/PLAAttribute.php @@ -12,6 +12,7 @@ * @package phpLDAPadmin * @subpackage Templates */ +#[\AllowDynamicProperties] class PLAAttribute { # Attribute Name public $name; diff --git a/lib/Query.php b/lib/Query.php index c79940fb..3348ad37 100644 --- a/lib/Query.php +++ b/lib/Query.php @@ -12,6 +12,7 @@ * @package phpLDAPadmin * @subpackage Queries */ +#[\AllowDynamicProperties] class Query extends xmlTemplate { protected $description = ''; public $results = array(); diff --git a/lib/Template.php b/lib/Template.php index 9eb3a88b..e458b983 100644 --- a/lib/Template.php +++ b/lib/Template.php @@ -28,6 +28,7 @@ * @todo RDN attributes need to be checked that are included in the schema, otherwise mark it is invalid * @todo askcontainer is no longer used? */ +#[\AllowDynamicProperties] class Template extends xmlTemplate { # If this template visible on the template choice list private $visible = true; diff --git a/lib/TemplateRender.php b/lib/TemplateRender.php index 55e612c1..74a5d618 100644 --- a/lib/TemplateRender.php +++ b/lib/TemplateRender.php @@ -15,6 +15,8 @@ class TemplateRender extends PageRender { # Page number private $pagelast; + private $url_base; + private $layout; /** CORE FUNCTIONS **/ diff --git a/lib/ds_ldap.php b/lib/ds_ldap.php index 11c527d2..e1a80c21 100644 --- a/lib/ds_ldap.php +++ b/lib/ds_ldap.php @@ -204,10 +204,13 @@ protected function connect($method,$debug=false,$new=false) { if (function_exists('run_hook')) run_hook('pre_connect',array('server_id'=>$this->index,'method'=>$method)); - if ($this->getValue('server','port')) - $resource = ldap_connect($this->getValue('server','host'),$this->getValue('server','port')); - else - $resource = ldap_connect($this->getValue('server','host')); + $uri = $this->getValue('server','host'); + if (strpos($uri, '://') === false) { + $uri = 'ldap://' . urlencode($uri); + if ($this->getValue('server','port')) + $uri .= ':' . $this->getValue('server','port'); + } + $resource = ldap_connect($uri); $this->noconnect = false; $CACHE[$this->index][$method] = $resource; diff --git a/lib/functions.php b/lib/functions.php index 81624088..1fdda238 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -145,7 +145,7 @@ function app_error_handler($errno,$errstr,$file,$lineno) { $errtype = ''; switch ($errno) { - case E_STRICT: $errtype = 'E_STRICT'; break; + case E_DEPRECATED: $errtype = 'E_DEPRECATED'; break; case E_ERROR: $errtype = 'E_ERROR'; break; case E_WARNING: $errtype = 'E_WARNING'; break; case E_PARSE: $errtype = 'E_PARSE'; break; @@ -642,8 +642,17 @@ function error($msg,$type='note',$redirect=null,$fatal=false,$backtrace=false) { _('Function'),$line['function']); if (isset($line['args'])) { - $display = strlen(serialize($line['args'])) < 50 ? htmlspecialchars(serialize($line['args'])) : htmlspecialchars(substr(serialize($line['args']),0,50)).'...'; - $_SESSION['backtrace'][$error]['args'] = $line['args']; + $args = $line['args']; + // Filter out SensitiveParameterValue objects + $args = array_map(function ($arg) { + if ($arg instanceof \SensitiveParameterValue) { + return '**SENSITIVE**'; + } + return $arg; + }, $args); + + $display = strlen(serialize($args)) < 50 ? htmlspecialchars(serialize($args)) : htmlspecialchars(substr(serialize($args),0,50)).'...'; + $_SESSION['backtrace'][$error]['args'] = $args; if (file_exists(LIBDIR.'../tools/unserialize.php')) $body .= sprintf(' (%s)', '../tools/unserialize.php',$error,$display); diff --git a/lib/import_functions.php b/lib/import_functions.php index 685676f8..3b683400 100644 --- a/lib/import_functions.php +++ b/lib/import_functions.php @@ -144,6 +144,7 @@ public function LDAPimport() { * @package phpLDAPadmin * @subpackage Import */ +#[\AllowDynamicProperties] class ImportLDIF extends Import { private $_currentLineNumber = 0; private $_currentLine = ''; diff --git a/lib/page.php b/lib/page.php index 43efc2a7..e8241a94 100644 --- a/lib/page.php +++ b/lib/page.php @@ -12,6 +12,7 @@ * @package phpLDAPadmin * @subpackage Page */ +#[\AllowDynamicProperties] class page { # pre-HTML headers protected $_pageheader; diff --git a/lib/schema_functions.php b/lib/schema_functions.php index 62180643..70c6e8b9 100644 --- a/lib/schema_functions.php +++ b/lib/schema_functions.php @@ -24,7 +24,7 @@ abstract class SchemaItem { # The description of this schema item. protected $description = ''; # Boolean value indicating whether this objectClass is obsolete - private $is_obsolete = false; + protected $is_obsolete = false; public function setOID($oid) { if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS')) diff --git a/lib/xml2array.php b/lib/xml2array.php index d260c9e4..4b10b709 100644 --- a/lib/xml2array.php +++ b/lib/xml2array.php @@ -33,10 +33,9 @@ private function pop_pos() { public function parseXML($strInputXML,$filename) { $this->resParser = xml_parser_create(); - xml_set_object($this->resParser,$this); - xml_set_element_handler($this->resParser,'tagOpen','tagClosed'); + xml_set_element_handler($this->resParser, [$this, 'tagOpen'], [$this, 'tagClosed']); - xml_set_character_data_handler($this->resParser,'tagData'); + xml_set_character_data_handler($this->resParser, [$this, 'tagData']); $this->push_pos($this->arrOutput);