Package: phpldapadmin / 1.2.6.3-0.3+deb12u1

Fix-trim-null-PHP-8.patch Patch series | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
From: William Desportes <williamdes@wdes.fr>
Date: Sat, 18 Mar 2023 15:42:04 +0100
Subject: Fix trim(): Passing null to parameter #1  is deprecated

- Unrecognized error number: 8192: trim(): Passing null to parameter #1 ($string) of type string is deprecated

Origin: upstream
Forwarded: https://github.com/leenooks/phpLDAPadmin/commit/9488fe2ed7841bffc322c6c9afeb9fc3e2bd0a42
---
 htdocs/cmd.php | 2 +-
 lib/ds.php     | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/htdocs/cmd.php b/htdocs/cmd.php
index 0ddf004..8a9d089 100644
--- a/htdocs/cmd.php
+++ b/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 ($www['cmd'] && trim($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/lib/ds.php b/lib/ds.php
index 31700d3..d54099e 100644
--- a/lib/ds.php
+++ b/lib/ds.php
@@ -437,7 +437,8 @@ abstract class DS {
 		if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
 			debug_log('Entered (%%)',17,0,__FILE__,__LINE__,__METHOD__,$fargs);
 
-		if (! trim($this->getLogin(null)) && $_SESSION[APPCONFIG]->getValue('appearance','anonymous_bind_implies_read_only'))
+		$login = $this->getLogin(null);
+		if (!($login && trim($login)) && $_SESSION[APPCONFIG]->getValue('appearance','anonymous_bind_implies_read_only'))
 			return true;
 		else
 			return $this->getValue('server','read_only');