pagequery icon indicating copy to clipboard operation
pagequery copied to clipboard

Warning: count(): Parameter must be an array or an object ....

Open joergdd opened this issue 7 years ago • 2 comments

What does this error mean and how do you get it off?

Error: "Warning: count(): Parameter must be an array or an object that implements Countable in C:\xampp\htdocs\lib\plugins\pagequery\inc\pagequery.php on line 1124"

usage: {{pagequery> @tech_doku:software:ms_excel:tipps_und_tricks *; hidestart; sort=a,name; filter=!name:c_template; proper; display={title}; bullet=disc }}

joergdd avatar Mar 20 '18 13:03 joergdd

Plugin was throwing the very same error on me, fortunately it is easy to fix.

Open pagequery.php and move line 1124 ($level = count($group_opts['key']) - 1;) to line 1139 (just before foreach($sort_array as $row) {).

Or edit it according to this diff:

@@ -1121,7 +1121,6 @@
      *                              array(0, '...') =>  0 = normal row item (not heading)
      */
     function mgroup(&$sort_array, $keys, $group_opts = array()) {
-        $level = count($group_opts['key']) - 1;
         $prevs = array();
         $results = array();
         $idx = 0;
@@ -1137,6 +1136,7 @@
                 $results[] = $result;
             }
         } else {
+            $level = count($group_opts['key']) - 1;
             foreach($sort_array as $row) {
                 $this->_add_heading($results, $sort_array, $group_opts, $level, $idx, $prevs);
                 $result = array(0); // basic item (page link) is level 0

FurloSK avatar Oct 08 '19 20:10 FurloSK

@MrBertie Still seeing this today in the latest version: [18-Oct-2020 12:05:24 Europe/Amsterdam] PHP Warning: count(): Parameter must be an array or an object that implements Countable in D:\www\wild-water.nl\www\dokuwiki\lib\plugins\pagequery\inc\pagequery.php on line 1124

mprins avatar Oct 18 '20 10:10 mprins