From ae60b9a7066cd92c61ff52e0376f83808f095aa3 Mon Sep 17 00:00:00 2001 From: lacatoire Date: Mon, 15 Dec 2025 20:50:29 +0100 Subject: [PATCH 1/2] Fix: Stop using null as array offset (Resolves #227) --- phpdotnet/phd/Package/PHP/Web.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/phpdotnet/phd/Package/PHP/Web.php b/phpdotnet/phd/Package/PHP/Web.php index ad36b7cf..e5b34a00 100644 --- a/phpdotnet/phd/Package/PHP/Web.php +++ b/phpdotnet/phd/Package/PHP/Web.php @@ -204,7 +204,8 @@ public function header($id) { "alternatives" => $this->cchunk["alternatives"], "source" => $this->sourceInfo($id), ); - $setup["history"] = $this->history[$setup["source"]["path"]] ?? []; + $history = $this->history ?? []; + $setup["history"] = $history[$setup["source"]["path"]] ?? []; if ($this->getChildren($id)) { $lang = $this->config->language; $setup["extra_header_links"] = array( From e69ba8d373ac36081c7faa2104d9e1d9f9d52db6 Mon Sep 17 00:00:00 2001 From: Louis-Arnaud Catoire Date: Thu, 18 Dec 2025 09:38:54 +0100 Subject: [PATCH 2/2] This also avoids accessing "path" on a null source when sourceInfo() returns null. --- phpdotnet/phd/Package/PHP/Web.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/phpdotnet/phd/Package/PHP/Web.php b/phpdotnet/phd/Package/PHP/Web.php index e5b34a00..0489113c 100644 --- a/phpdotnet/phd/Package/PHP/Web.php +++ b/phpdotnet/phd/Package/PHP/Web.php @@ -205,7 +205,13 @@ public function header($id) { "source" => $this->sourceInfo($id), ); $history = $this->history ?? []; - $setup["history"] = $history[$setup["source"]["path"]] ?? []; + + $sourcePath = $setup["source"]["path"] ?? null; + + $setup["history"] = $sourcePath !== null + ? ($history[$sourcePath] ?? []) + : []; + if ($this->getChildren($id)) { $lang = $this->config->language; $setup["extra_header_links"] = array(