[pmwiki-users] pagelist.php: Array and string offset access syntax with curly braces is deprecated

T. Michael Sommers tmsommers2 at gmail.com
Tue May 4 20:39:18 PDT 2021


I have a brand new installation of pmwiki, from a tarball downloaded a 
few weeks ago.  I am using php 7.4.3 on FreeBSD 11.2-RELEASE-p3.  I get 
warnings saying, "Array and string offset access syntax with curly 
braces is deprecated" for scripts/pagelist.php.

This is a diff that fixes them:

--- snip ---
--- pagelist.php.orig	2021-05-04 23:36:16.309938000 -0400
+++ pagelist.php	2021-05-04 23:37:48.634086000 -0400
@@ -434,7 +434,7 @@
            if (preg_match($i, $text)) return 0;
          foreach((array)@$opt['=inclp'] as $i)
            if (!preg_match($i, $text)) {
-            if ($i{0} == '$') $reindex[] = $pn;
+            if ($i[0] == '$') $reindex[] = $pn;
              return 0;
            }
        }
@@ -488,9 +488,9 @@
                as $o) {
          $ret |= PAGELIST_POST;
          $r = '+';
-        if ($o{0} == '-') { $r = '-'; $o = substr($o, 1); }
+        if ($o[0] == '-') { $r = '-'; $o = substr($o, 1); }
          $opt['=order'][$o] = $r;
-        if ($o{0} != '$' &&
+        if ($o[0] != '$' &&
              (!isset($PageListSortRead[$o]) || $PageListSortRead[$o]))
            $ret |= PAGELIST_ITEM;
        }
--- snip ---

-- 
T.M. Sommers -- tmsommers2 at gmail.com -- ab2sb



More information about the pmwiki-users mailing list