Using module_invoke() and render() causes PHP warnings From within a block, I've used the following PHP to add additional blocks inside it:

$content_search = module_invoke('search_api_page', 'block_view', 'content_search');
$user_search = module_invoke('search_api_page', 'block_view', 'user_search');

print render($content_search);
print render($user_search);


When I do so, I get the following warnings:


  Warning: Invalid argument supplied for foreach() in element_children() (line 6541 of /var/www/mysite.dev/public_html/includes/common.inc).
  Warning: Illegal string offset '#children' in drupal_render() (line 5998 of /var/www/mysite.dev/public_html/includes/common.inc).
  Warning: Illegal string offset '#children' in drupal_render() (line 6008 of /var/www/mysite.dev/public_html/includes/common.inc).


It appears that the problem is tied to the render() function as I can call print_r($content_search) and everything looks good, but I can't render the blocks without these warnings.
Blocks aren't render arrays, they're made up of a subject and content key.

You'll probably have better luck referring to those explicitly:

$content_search = module_invoke('search_api_page', 'block_view', 'content_search');
$user_search = module_invoke('search_api_page', 'block_view', 'user_search');

print render($content_search['content']);
print render($user_search['content']);