Use native booleans for prepared SQL params; stop binding db_get_boolean() values (#1019)

Prepared statements were binding DB-specific boolean literals (`'t'/'f'`) produced by `db_get_boolean()`, which breaks PostgreSQL parameter typing in some paths (notably mailbox creation via handler flows). 

This change standardizes bound boolean parameters to native PHP `true`/`false` (which are then cast to 0/1 which seems to work fine within PDO/PostgreSQL).

fixes https://github.com/postfixadmin/postfixadmin/issues/1017
This commit is contained in:
Copilot authored and GitHub committed 2026-04-23 19:28:01 +01:00
1 parent 2cce49a657
commit ae7339afd4
11 files changed
+57 -51

No files matched your search

+2 -3
View File
@@ -565,8 +565,7 @@ abstract class PFAHandler
foreach ($db_values as $key => $val) {
switch ($this->struct[$key]['type']) { # modify field content for some types
case 'bool':
$val = (string)$val;
$db_values[$key] = db_get_boolean($val);
$db_values[$key] = (bool) $val;
break;
case 'pass':
$val = (string)$val;
@@ -876,7 +875,7 @@ abstract class PFAHandler
public function checkPasswordRecoveryCode($username, $token)
{
$table = table_by_key($this->db_table);
$active = db_get_boolean(true);
$active = true;
$now = date('Y-m-d H:i:s');