2

Since i'm in PHP 5.6, i have this warning (not in PHP 5.2) :

PHP Strict Standards:  Only variables should be passed by reference in blockcategories_top.php on line 157

Here is the line 157 :

line 155    if ($cookie->last_visited_category) {
line 156      $c = new Category(intval($cookie->last_visited_category));
line 157      $oldies = array_pop($c->getParentsCategories());
line 158      $oldies = $oldies['id_category'];
line 159      $smarty->assign('oldies', $oldies);
line 160    }

Please, how can i fix it ? :)

Thanks !

Shark34
  • 69
  • 1
  • 7

1 Answers1

13

Just replace

$oldies = array_pop($c->getParentsCategories());

with

$oldies = $c->getParentsCategories();
$oldies = array_pop($oldies);

The warning happens because array_pop expects the parameter to be a reference, and function return values are not.

Matteo Tassinari
  • 18,121
  • 8
  • 60
  • 81