Skip to content

Commit c2ddbf4

Browse files
committed
fix: remove invalid named arguments from sprintf() calls
sprintf() does not accept named parameters for its variadic $values argument in PHP 8.x, causing an ArgumentCountError. This broke local login when LDAP support was enabled, as the LDAP lookup failure path crashed before falling back to local authentication.
1 parent e84560b commit c2ddbf4

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

phpmyfaq/src/phpMyFAQ/Controller/Api/BackupController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function download(Request $request): Response
110110
$backupFile = $backup->createContentFolderBackup();
111111
$response = new Response(file_get_contents($backupFile));
112112

113-
$backupFileName = sprintf(format: 'content_%s.zip', values: date(format: 'dmY_H-i'));
113+
$backupFileName = sprintf('content_%s.zip', date('dmY_H-i'));
114114

115115
$disposition = HeaderUtils::makeDisposition(
116116
HeaderUtils::DISPOSITION_ATTACHMENT,

phpmyfaq/src/phpMyFAQ/Ldap.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ public function connect(
118118

119119
if (false === $ldapBind) {
120120
$this->errno = ldap_errno($this->ds);
121-
$this->error = sprintf(format: 'Unable to bind to LDAP server (Error: %s).', values: ldap_error($this->ds));
121+
$this->error = sprintf('Unable to bind to LDAP server (Error: %s).', ldap_error($this->ds));
122122
$this->ds = false;
123123

124124
return false;
@@ -209,7 +209,7 @@ private function getLdapData(string $username, string $data): bool|string
209209

210210
if (!$entryId) {
211211
$this->errno = ldap_errno($this->ds);
212-
$this->error = sprintf(format: 'Cannot get the value(s). Error: %s', values: ldap_error($this->ds));
212+
$this->error = sprintf('Cannot get the value(s). Error: %s', ldap_error($this->ds));
213213

214214
return false;
215215
}
@@ -281,7 +281,7 @@ private function getLdapDn(string $username): string|false
281281
$entryId = ldap_first_entry($this->ds, $sr);
282282

283283
if (false === $entryId) {
284-
$this->error = sprintf(format: 'Cannot get the value(s). Error: %s', values: ldap_error($this->ds));
284+
$this->error = sprintf('Cannot get the value(s). Error: %s', ldap_error($this->ds));
285285

286286
return false;
287287
}
@@ -339,7 +339,7 @@ public function getGroupMemberships(string $username): array|false
339339

340340
if (!$entryId) {
341341
$this->errno = ldap_errno($this->ds);
342-
$this->error = sprintf(format: 'Cannot get the value(s). Error: %s', values: ldap_error($this->ds));
342+
$this->error = sprintf('Cannot get the value(s). Error: %s', ldap_error($this->ds));
343343

344344
return false;
345345
}

0 commit comments

Comments
 (0)