From a7c05dac1b5f4993cadb19cdb36691fb7259a2bc Mon Sep 17 00:00:00 2001 From: Patrick Monnerat Date: Wed, 9 Apr 2025 16:48:23 +0200 Subject: [PATCH 1/5] Some php 8 deprecation fixes --- lib/HTMLTree.php | 3 ++- lib/ds_ldap.php | 11 +++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) 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/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; From ab3764b6ee7e16be4c9c3c378e6359d851aa5518 Mon Sep 17 00:00:00 2001 From: William Desportes Date: Tue, 24 Dec 2024 11:29:54 +0100 Subject: [PATCH 2/5] Replace E_STRICT by E_DEPRECATED Origin: vendor Forwarded: no --- lib/functions.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/functions.php b/lib/functions.php index 81624088..293df6bf 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; From 0cbe31224574e89f7f05ee407eecc095bc50de8a Mon Sep 17 00:00:00 2001 From: William Desportes Date: Tue, 31 Dec 2024 17:54:35 +0100 Subject: [PATCH 3/5] Stop using xml_set_object for PHP 8.4 Same fix as https://github.com/tecnickcom/TCPDF/pull/734 Origin: vendor Forwarded: no --- lib/xml2array.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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); From 9b2ef1bb611fa22199a29d05ef9ff58ee6c25094 Mon Sep 17 00:00:00 2001 From: William Desportes Date: Tue, 31 Dec 2024 18:21:27 +0100 Subject: [PATCH 4/5] Fix deprecation for the Serialization of SensitiveParameterValue Uncaught Exception: Serialization of 'SensitiveParameterValue' is not allowed in /usr/share/phpldapadmin/lib/functions.php:645 Origin: vendor Forwarded: no --- lib/functions.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/functions.php b/lib/functions.php index 293df6bf..1fdda238 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -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); From 1f599a2bc38dfab4b7e4b380d017dde23d31cf21 Mon Sep 17 00:00:00 2001 From: William Desportes Date: Sat, 18 Mar 2023 15:36:58 +0100 Subject: [PATCH 5/5] Fix Creation of dynamic property - Deprecated: Creation of dynamic property page::$index is deprecated in /usr/share/phpldapadmin/lib/page.php on line 38 - Deprecated: Creation of dynamic property page::$sysmsg is deprecated in /usr/share/phpldapadmin/lib/page.php on line 468 - Deprecated: Creation of dynamic property page::$_block is deprecated in /usr/share/phpldapadmin/lib/page.php on line 241 - Creation of dynamic property Template::$askcontainer is deprecated - Creation of dynamic property PLAAttribute::$js is deprecated (on create entry of type Thunderbird) - On import feature - On export feature - And others.. Origin: vendor Forwarded: https://github.com/leenooks/phpLDAPadmin/pull/202 Bug-Debian: https://bugs.debian.org/1100771 --- lib/PLAAttribute.php | 1 + lib/Query.php | 1 + lib/Template.php | 1 + lib/TemplateRender.php | 2 ++ lib/import_functions.php | 1 + lib/page.php | 1 + lib/schema_functions.php | 2 +- 7 files changed, 8 insertions(+), 1 deletion(-) 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/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'))