VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: marvays on November 22, 2018, 04:51:01 AM

Title: Warning: vmpagination.php
Post by: marvays on November 22, 2018, 04:51:01 AM
Good morning. What is this error, please:
Warning: count(): Parameter must be an array or an object that implements Countable in /data/www/23045/lukysipy_cz/www/administrator/components/com_virtuemart/helpers/vmpagination.php on line 140

I have latest joomla and latest VM.
Title: Re: Warning: vmpagination.php
Post by: AH on November 22, 2018, 10:51:50 AM
Provide more information as to what you are doing when you get this error.  As you appear to be the only one reporting it.

Saying that you are on the latest versions means nothing - please state the version you are using.
Title: Re: Warning: vmpagination.php
Post by: marvays on November 23, 2018, 19:27:22 PM
hi.
VirtueMart 3.4.2
Joomla! 3.9.0

display in all pages where is pagination.
(http://www.imagehosting.cz/thumbs/123cyc.png) (http://www.imagehosting.cz/?v=123cyc.png)
Title: Re: Warning: vmpagination.php
Post by: GJC Web Design on November 24, 2018, 17:46:26 PM
normally means the count($xxx) is not an array or object

you need to backtrace what is being "counted" -- maybe it needs a if(is_array($xxx)) { etc

code is

         if(empty($sequence)) {
            $sequence = VmConfig::get( 'pagseq', 0 );
         }

         if(!empty($sequence)) {
            $sequenceArray = explode( ',', $sequence );
            if(count( $sequenceArray>1 )) {
               foreach( $sequenceArray as $items ) {
                  $limits[$items] = JHtml::_( 'select.option', $items );
               }
            }
         }

what have u got in your pagination sequence in VM config?

must be comma separated
Title: Re: Warning: vmpagination.php
Post by: marvays on November 24, 2018, 18:40:39 PM
(http://www.imagehosting.cz/thumbs/nastavenla.png) (http://www.imagehosting.cz/?v=nastavenla.png)
Title: Re: Warning: vmpagination.php
Post by: marvays on November 24, 2018, 18:50:51 PM
I try delete this:
if(!empty($sequence)) {
$sequenceArray = explode( ',', $sequence );
if(count( $sequenceArray>1 )) {
foreach( $sequenceArray as $items ) {
$limits[$items] = JHtml::_( 'select.option', $items );
}
}
}

and look fine :)
Title: Re: Warning: vmpagination.php
Post by: Milbo on November 26, 2018, 14:36:46 PM
Please try our dev version. I think that is fixed. You use php7.2, right? http://dev.virtuemart.net/attachments/download/1149/com_virtuemart.3.4.3.9989_package_or_extract.zip
Title: Re: Warning: vmpagination.php
Post by: marvays on November 26, 2018, 15:29:00 PM
Yes. But i can change to 7.1 or 5.6 . . . if you want.
Title: Re: Warning: vmpagination.php
Post by: Milbo on December 02, 2018, 23:02:35 PM
It should work in any relevant php version, but I think at most intersting is php7.2.
Title: Re: Warning: vmpagination.php
Post by: biltong on April 10, 2019, 14:59:49 PM
Hi,

Am am getting this error as well, in PHP error log file, since updating VirtueMart from 3.2.14 to 3.4.2.

[14-Feb-2019 17:44:08 Europe/London] PHP Warning:  count(): Parameter must be an array or an object that implements Countable in /home/xxxxx/public_html/administrator/components/com_virtuemart/helpers/vmpagination.php on line 190


Joomla v3.9.5
PHP 7.2.16
Title: Re: Warning: vmpagination.php
Post by: Milbo on April 15, 2019, 14:54:09 PM
Please test if you have the error also with http://dev.virtuemart.net/attachments/1160/com_virtuemart.3.4.5.10045_package_or_extract.zip
Title: Re: Warning: vmpagination.php
Post by: jamesofdps on September 24, 2019, 10:57:19 AM
Can you confirm if version 3.6.2 successfully addresses the PHP Warning:  count(): Parameter must be an array or an object that implements Countable in administrator/components/com_virtuemart/helpers/vmpagination.php on line 140 issue or advise of an alternative fix.
Title: Re: Warning: vmpagination.php
Post by: GJC Web Design on September 24, 2019, 12:30:20 PM
It is assumed so as I and none of the testers/devs have seen this problem