Keyword

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

More
3 years 7 months ago #176891 by CPBA
Hola, actualice la versión 2.10.3 de K2 y mirando el log de errores note estos PHP Warning recurrentes haciendo referencia a los archivos category.php y item.php del componente K2.
Podrían orientarme a que se puede deber esto?
Gracias

PHP Warning: count(): Parameter must be an array or an object that implements Countable in

Haciendo referencia

/var/www/html/xxxx/public_html/templates/gk_news/html/com_k2/templates/default/category.php on line 214

/var/www/html/xxxx/public_html/templates/gk_news/html/com_k2/templates/default/item.php on line 26

Please Log in or Create an account to join the conversation.

More
3 years 7 months ago #176893 by JoomlaWorks
You need to slightly update your K2 template overrides for PHP 7.

The issue has been discussed extensively here: www.joomlaworks.net/forum/k2-en/51050-warning-count-parameter-must-be-an-array-or-an-object-that-implements

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

More
3 years 7 months ago #176898 by CPBA
Fotis, Gracias por su respuesta consultando la información del post que me sugiere encuentro esto.

En mi archivo K2 item.php en la línea 262 figura

<?php if($params->get('itemExtraFields') && count($this->item->extra_fields)): ?>

Debería entonces reemplazarlo por lo que figura en la linea 244 de archive item.php del K2-Master es correcto, modificando solo es línea?

<?php if($this->item->params->get('itemExtraFields') && isset($this->item->extra_fields) && count($this->item->extra_fields)): ?>

Ya que por lo que veo son versiones bastante diferentes, es decir el que tengo yo es mucho más antigua que la versión de K2-Master que descargo.

Para el otro archivo que mención en mi consulta el category.php, el error se indica en la línea 214 que figura lo siguiente:

214 <?php if(count($this->pagination->getPagesLinks())): ?>
215 <?php if($this->params->get('catPagination')): ?>
216 <?php echo str_replace('</ul>', '<li class="counter">'.$this->pagination->getPagesCounter().'</li></ul>', $this->pagination->getPagesLinks()); ?>
217 <?php endif; ?>
218 <?php endif; ?>
219 <?php endif; ?>

Pero consultado master entindo que fue reemplazado por eso que se encuentra apartir de la lina 235?

235 <!-- Pagination -->
<?php if ($this->pagination->getPagesLinks()): ?>
<div class="k2Pagination">
<?php if ($this->params->get('catPagination', 1)): ?>
<div class="k2PaginationLinks">
<?php echo $this->pagination->getPagesLinks(); ?>
</div>
<?php endif; ?>
<?php if ($this->params->get('catPaginationResults', 1)): ?>
<div class="k2PaginationCounter">
<?php echo $this->pagination->getPagesCounter(); ?>
</div>
<?php endif; ?>
</div>
<?php endif; ?>
<?php endif; ?>

Desde ya muchas gracias nuvamente por su ayuda.

Please Log in or Create an account to join the conversation.

More
3 years 7 months ago #176904 by JoomlaWorks
Yes, you should update all the checks that have a reference to PHP's count() function.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum