RS 9.3 SVN error: count(): Parameter must be an array or an object that implements Countable

30 views
Skip to first unread message

ronnie zeiller

unread,
Jun 11, 2020, 10:50:24 AM6/11/20
to ResourceSpace

Got error on PHP 7.3 RS SVN install revision 15141

/include/resource_functions.php line 2822: count(): Parameter must be an array or an object that implements Countable


# This patch file was generated by NetBeans IDE
# It uses platform neutral UTF-8 encoding and \n newlines.
--- a/<html>resource_functions.php (<b>Today 14:20:58</b>)</html>
+++ b/<html><b>Current File</b></html>
@@ -2819,7 +2819,7 @@
     
# for all the resource references in the array $refs.
     
# This will use a single SQL query and is therefore a much more efficient way of gathering
     
# resource data for a list of resources (e.g. search result display for a page of resources).
-    if (count($refs)==0) {return array();} # return an empty array if no resources specified (for empty result sets)
+    if (!is_array($refs) || count($refs)==0) {return array();} # return an empty array if no resources specified (for empty result sets)
     $refsin
=join(",",$refs);
     $results
=sql_query("select d.resource,f.*, f.field_constraint,d.value from resource_type_field f left join resource_data d on d.resource_type_field=f.ref and d.resource in ($refsin) where (f.resource_type=0 or f.resource_type in (select resource_type from resource where ref=d.resource)) order by d.resource,f.order_by,f.ref");
     $return
=array();


Actually I had this on 9.2 and before too.
Would be nice if that could get fixed in 9.3

Best,
Ronnie

Ronnie Zeiller

unread,
Jun 26, 2022, 6:38:14 AM6/26/22
to ResourceSpace
It seems that this bug still consists in version 9.8

In the meantime it is in line 3017....
In some cases  it gets the resource-id as  integer and not as array()

/include/resource_functions.php line 3017: count(): Parameter must be an array or an object that implements Countable


resourcespace-error-message.png
Reply all
Reply to author
Forward
0 new messages