01103: Bug in vardoc.php

Summary: Bug in vardoc.php
Created: 2009-06-29 08:40
Status: Closed (fixed for 2.2.3)
Category: Bug
Assigned:
Priority: 3
Version: 2.2.2
OS:

Description: As noted on PmWikiUsers:2009-February/053945.html, there's a bug on line 53 of scripts/vardoc.php, as the ReadPage function is uselessly called without a second parameter, resulting in the whole history of PmWiki.Variables being read on every single page access instead of just the current page contents.

Here's a fix:

--- vardoc.php	2009-03-12 09:36:08.000000000 +0200
+++ vardoc.php	2009-06-29 16:38:08.000000000 +0300
@@ -50,7 +50,7 @@
       for($i=0;$i<count($t);$i++) 
         if (@!$loaded[$t[$i]['pagename']]) $vlist[]=$t[$i]['pagename'];
     foreach($vlist as $vname) {
-      $vpage = ReadPage($vname); @$loaded[$vname]++;
+      $vpage = ReadPage($vname, READPAGE_CURRENT); @$loaded[$vname]++;
       if (!$vpage) continue;
       if (!preg_match_all("/\n:\\$([[:upper:]]\\w+):/",@$vpage['text'],$match))
         continue;