protected function getTree(){ $tree = []; debug($this->data);//тестовая ф-ция выводит массив категорий как положено foreach ($this->data as $id=>&$node) if (!$node['parent_id']){//здесь возникает ошибка $tree[$id] = &$node; } else { $this->data[$node['parent_id']]['childs'][$node['id']] = &$node; } } return $tree; } 

The code stopped working suddenly. Thank you in advance.

    1 answer 1

    The warning indicates that the parent_id key does not exist in the $node array.

    Change the check:

     if (!isset($node['parent_id'])){ 

    Harmful advice - turn off the warnings:

     error_reporting(E_ALL & ~E_NOTICE); 
    • Only now it worked. I did not touch the code. Maybe something from the database. - SerjS