From 03b5b56f7143e3fa1c49a10674fcd6570d128027 Mon Sep 17 00:00:00 2001 From: Dmitry Esenin Date: Fri, 15 Aug 2025 10:55:23 +0300 Subject: [PATCH 1/2] fix(Fetch.php): warning when preparing condition for log message --- core/components/pdotools/src/Fetch.php | 27 ++------------------------ 1 file changed, 2 insertions(+), 25 deletions(-) diff --git a/core/components/pdotools/src/Fetch.php b/core/components/pdotools/src/Fetch.php index 50377e9f..1378e0a7 100644 --- a/core/components/pdotools/src/Fetch.php +++ b/core/components/pdotools/src/Fetch.php @@ -222,21 +222,7 @@ public function addWhere() $where = $this->additionalConditions($where); if (!empty($where)) { $this->query->where($where); - $condition = []; - foreach ($where as $k => $v) { - if (is_array($v)) { - if (isset($v[0])) { - $condition[] = is_array($v) ? $k . '(' . implode(',', $v) . ')' : $k . '=' . $v; - } else { - foreach ($v as $k2 => $v2) { - $condition[] = is_array($v2) ? $k2 . '(' . implode(',', $v2) . ')' : $k2 . '=' . $v2; - } - } - } else { - $condition[] = $k . '=' . $v; - } - } - $this->addTime('Added where condition: ' . implode(', ', $condition) . '', microtime(true) - $time); + $this->addTime('Added where condition: ' . json_encode($where) . '', microtime(true) - $time); } $time = microtime(true); if (!empty($this->config['having'])) { @@ -249,16 +235,7 @@ public function addWhere() } $having = $this->replaceTVCondition($tmp); $this->query->having($having); - - $condition = []; - foreach ($having as $k => $v) { - if (is_array($v)) { - $condition[] = $k . '(' . implode(',', $v) . ')'; - } else { - $condition[] = $k . '=' . $v; - } - } - $this->addTime('Added having condition: ' . implode(', ', $condition) . '', microtime(true) - $time); + $this->addTime('Added having condition: ' . json_encode($having) . '', microtime(true) - $time); } } From 57e30c7553566e4cb37aba0857b96d96a213010d Mon Sep 17 00:00:00 2001 From: Dmitry Esenin Date: Mon, 27 Apr 2026 12:48:01 +0300 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Bochkarev Ivan --- core/components/pdotools/src/Fetch.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/components/pdotools/src/Fetch.php b/core/components/pdotools/src/Fetch.php index 1378e0a7..c2227e9c 100644 --- a/core/components/pdotools/src/Fetch.php +++ b/core/components/pdotools/src/Fetch.php @@ -222,7 +222,8 @@ public function addWhere() $where = $this->additionalConditions($where); if (!empty($where)) { $this->query->where($where); - $this->addTime('Added where condition: ' . json_encode($where) . '', microtime(true) - $time); + $whereLog = json_encode($where); + $this->addTime('Added where condition: ' . ($whereLog !== false ? $whereLog : print_r($where, true)) . ' ', microtime(true) - $time); } $time = microtime(true); if (!empty($this->config['having'])) { @@ -235,7 +236,8 @@ public function addWhere() } $having = $this->replaceTVCondition($tmp); $this->query->having($having); - $this->addTime('Added having condition: ' . json_encode($having) . '', microtime(true) - $time); + $havingLog = json_encode($having); + $this->addTime('Added having condition: ' . ($havingLog !== false ? $havingLog : print_r($having, true)) . ' ', microtime(true) - $time); } }