get_category_children/ the new get_term_children not work

get_term_children returns an array or an object (WP_Error) and you are treating it like a string when you try to feed it to substr. I am not sure what you are trying to do with that line of code but in general you need to check that you are dealing with an array and not an error and process accordingly.

$cat_children = get_category_children( $category->term_id, '', ', ');
if (is_wp_error($cat_children)) {
  // do stuff
} elseif (is_array($cat_children)) {
  // do other stuff
  // I don't really know what you want to do here. 
  // Your code would, if I am reading right, chop two characters off of a string
  // which strikes me as a odd thing to do given the data you dealing with
}

http://php.net/manual/en/function.substr.php

http://codex.wordpress.org/Function_Reference/is_wp_error

http://php.net/manual/en/function.is-array.php