[DOC-CVS] [phd] master: Fix: Prevent using null as array offset in Package/PHP/Web (#228)
[email protected] (Louis-Arnaud via GitHub)
| Newsgroups | php.doc.cvs |
|---|---|
| Message-ID | <[email protected]> |
Author: Louis-Arnaud (lacatoire) Committer: GitHub (web-flow) Pusher: Girgias Date: 2026-01-11T20:32:45Z Commit: https://github.com/php/phd/commit/91384413a2d76e53ac338bb86703ea19b08041ad Raw diff: https://github.com/php/phd/commit/91384413a2d76e53ac338bb86703ea19b08041ad.diff Fix: Prevent using null as array offset in Package/PHP/Web (#228) * Fix: Stop using null as array offset (Resolves #227) * This also avoids accessing "path" on a null source when sourceInfo() returns null. --------- Co-authored-by: lacatoire <[email protected]> Changed paths: M phpdotnet/phd/Package/PHP/Web.php Diff: diff --git a/phpdotnet/phd/Package/PHP/Web.php b/phpdotnet/phd/Package/PHP/Web.php index 2ba54010..475f3870 100644 --- a/phpdotnet/phd/Package/PHP/Web.php +++ b/phpdotnet/phd/Package/PHP/Web.php @@ -204,7 +204,14 @@ public function header($id) { "alternatives" => $this->cchunk["alternatives"], "source" => $this->sourceInfo($id), ); - $setup["history"] = $this->history[$setup["source"]["path"]] ?? []; + $history = $this->history ?? []; + + $sourcePath = $setup["source"]["path"] ?? null; + + $setup["history"] = $sourcePath !== null + ? ($history[$sourcePath] ?? []) + : []; + if ($this->getChildren($id)) { $lang = $this->config->language; $setup["extra_header_links"] = array(