Commit:    15a2d2d21cf7818fcd673b434af2dd1b1039e3ad
Author:    Peter Cowburn <[email protected]>         Wed, 5 Feb 2020 20:53:21 
+0000
Parents:   5223f48cbe3b11ba98e62650557fddb06fb8f2d5
Branches:  master

Link:       
http://git.php.net/?p=web/php.git;a=commitdiff;h=15a2d2d21cf7818fcd673b434af2dd1b1039e3ad

Log:
Only access note array if there is a note

Fixes "Notice:  Trying to access array offset on value of type bool in ..."

Changed paths:
  M  include/shared-manual.inc


Diff:
diff --git a/include/shared-manual.inc b/include/shared-manual.inc
index 735d8ee8d..d534b0384 100644
--- a/include/shared-manual.inc
+++ b/include/shared-manual.inc
@@ -396,6 +396,12 @@ function manual_setup($setup) {
     $_SERVER['BASE_PAGE'] = $base . $setup['this'][0];
     $_SERVER['BASE_HREF'] = $MYSITE . $_SERVER['BASE_PAGE'];
 
+    $timestamps = array(
+        filemtime($_SERVER["DOCUMENT_ROOT"] . "/" . $_SERVER["BASE_PAGE"]),
+        filemtime($_SERVER["DOCUMENT_ROOT"] . "/include/prepend.inc"),
+        filemtime($_SERVER["DOCUMENT_ROOT"] . "/styles/theme-base.css"),
+    );
+
     // Load user note for this page
     list($filename, $title) = $PGI['this'];
 
@@ -404,15 +410,11 @@ function manual_setup($setup) {
         $filename = substr($filename, 0, -4);
     }
     $USERNOTES = manual_notes_load($filename);
-    $note = current($USERNOTES);
-    $lastusernote = $note["xwhen"];
+    if ($USERNOTES) {
+        $note = current($USERNOTES);
+        $timestamps[] = $note["xwhen"];
+    }
 
-    $timestamps = array(
-        filemtime($_SERVER["DOCUMENT_ROOT"] . "/" . $_SERVER["BASE_PAGE"]),
-        filemtime($_SERVER["DOCUMENT_ROOT"] . "/include/prepend.inc"),
-        filemtime($_SERVER["DOCUMENT_ROOT"] . "/styles/theme-base.css"),
-        $lastusernote,
-    );
     $lastmod = max($timestamps);
 
     $breadcrumbs = manual_navigation_breadcrumbs($setup);


--
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to