From 30576ac8b34d966a84bf4dd42cdf7e3dba4b8d1d Mon Sep 17 00:00:00 2001 From: Lars Gebhardt-Kusche Date: Fri, 2 Jan 2026 01:06:52 +0100 Subject: [PATCH] asdsad --- src/App/Search.php | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/src/App/Search.php b/src/App/Search.php index 321ede4..c096a19 100644 --- a/src/App/Search.php +++ b/src/App/Search.php @@ -89,22 +89,34 @@ final class Search $type = is_int($value) ? \PDO::PARAM_INT : \PDO::PARAM_STR; $stmt->bindValue($paramName, $value, $type); } + if (defined('APP_ENV') && APP_ENV === 'staging') { $ph = []; if (preg_match_all('/:([a-zA-Z0-9_]+)/', $sql, $m)) { $ph = array_unique($m[0]); } $paramKeys = array_keys($bind); - error_log('Search placeholders: ' . json_encode($ph)); - error_log('Search params: ' . json_encode($paramKeys)); + $log = [ + 'placeholders' => $ph, + 'params' => $paramKeys, + 'sql' => $sql, + 'bind' => $bind, + ]; + @file_put_contents(__DIR__ . '/../../debug/search_debug.log', print_r($log, true)); } + try { $stmt->execute(); + return $stmt->fetchAll(\PDO::FETCH_ASSOC) ?: []; } catch (\PDOException $e) { - error_log('Search SQL: ' . $sql); - error_log('Search bind: ' . print_r($bind, true)); - throw $e; + // Log into /debug/search_debug.log and continue with empty results + $logErr = [ + 'error' => $e->getMessage(), + 'sql' => $sql, + 'bind' => $bind, + ]; + @file_put_contents(__DIR__ . '/../../debug/search_debug.log', print_r($logErr, true)); + return []; } - return $stmt->fetchAll(\PDO::FETCH_ASSOC) ?: []; } }