From 49a7047773f30c5dea1da1076e69746edb497ece Mon Sep 17 00:00:00 2001 From: Dmitry Tretyakov <76806170+tretdm@users.noreply.github.com> Date: Wed, 25 Oct 2023 16:42:26 +0700 Subject: [PATCH] Patch array objects for PHP 8.1 (#999) * Patch array objects for PHP 8 * Reswitch getting counts * Update WallPresenter.php * Update WallPresenter.php * Fix --- Web/Presenters/WallPresenter.php | 10 +++++----- Web/Presenters/templates/Admin/Logs.xml | 2 +- Web/Presenters/templates/Search/Index.xml | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Web/Presenters/WallPresenter.php b/Web/Presenters/WallPresenter.php index 2f9d611d..f7928db8 100644 --- a/Web/Presenters/WallPresenter.php +++ b/Web/Presenters/WallPresenter.php @@ -74,7 +74,7 @@ final class WallPresenter extends OpenVKPresenter $this->template->paginatorConf = (object) [ "count" => $this->template->count, "page" => (int) ($_GET["p"] ?? 1), - "amount" => sizeof($this->template->posts), + "amount" => $this->template->posts->getRowCount(), "perPage" => OPENVK_DEFAULT_PER_PAGE, ]; @@ -152,9 +152,9 @@ final class WallPresenter extends OpenVKPresenter ->where("deleted", 0) ->order("created DESC"); $this->template->paginatorConf = (object) [ - "count" => sizeof($posts), + "count" => $posts->getRowCount(), "page" => (int) ($_GET["p"] ?? 1), - "amount" => sizeof($posts->page((int) ($_GET["p"] ?? 1), $perPage)), + "amount" => $posts->page((int) ($_GET["p"] ?? 1), $perPage)->getRowCount(), "perPage" => $perPage, ]; $this->template->posts = []; @@ -182,7 +182,7 @@ final class WallPresenter extends OpenVKPresenter $this->template->paginatorConf = (object) [ "count" => $count, "page" => (int) ($_GET["p"] ?? 1), - "amount" => sizeof($posts), + "amount" => $posts->getRowCount(), "perPage" => $pPage, ]; foreach($posts as $post) @@ -332,7 +332,7 @@ final class WallPresenter extends OpenVKPresenter foreach($photos as $photo) $post->attach($photo); - if(sizeof($videos) > 0) + if($videos->count() > 0) foreach($videos as $vid) $post->attach($vid); diff --git a/Web/Presenters/templates/Admin/Logs.xml b/Web/Presenters/templates/Admin/Logs.xml index ab5e62f5..8b279008 100644 --- a/Web/Presenters/templates/Admin/Logs.xml +++ b/Web/Presenters/templates/Admin/Logs.xml @@ -9,7 +9,7 @@ {/block} {block content} - {var $amount = sizeof($logs)} + {var $amount = $logs->getRowCount()}