fehlersuche 10

This commit is contained in:
rirat-0
2026-06-03 01:45:04 +02:00
parent 8143d501fa
commit 3dcbdbf23c
2 changed files with 21 additions and 5 deletions
-3
View File
@@ -1,8 +1,5 @@
<?php
require_once '/php/model/Article.php';
session_start();
ob_start();
+20 -1
View File
@@ -17,9 +17,28 @@ if ($_SERVER["REQUEST_METHOD"] === "GET" && isset($_GET["q"])) {
$articleManager = ArticleManager::getInstance();
$results = $articleManager->search($search);
$_SESSION["search_results"] = $results;
//$_SESSION["search_results"] = $results;
//$_SESSION["search_query"] = $search;
//$_SESSION["message"] = "new_search_results";
$safeArrayResults = [];
foreach ($results as $obj) {
$safeArrayResults[] = [
"id" => $obj->id,
"title" => $obj->title,
"content" => $obj->content,
"author" => $obj->author,
"category" => $obj->category,
"tags" => $obj->tags,
"creationDate" => $obj->creationDate
];
}
$_SESSION["search_results"] = $safeArrayResults; // Jetzt liegen hier sichere Arrays!
$_SESSION["search_query"] = $search;
$_SESSION["message"] = "new_search_results";
} catch (Exception $e){
$_SESSION["message"] = "internal_error";
}