Verified Commit 6d7d3646 authored by Juraj Nemec's avatar Juraj Nemec
Browse files

Issue #2884171 by mcdruid, Seth Snyder: The drupal_render() function could use...

Issue #2884171 by mcdruid, Seth Snyder: The drupal_render() function could use a bit more protection
parent 40d1dbb9
Loading
Loading
Loading
Loading
+1 −1
Changes for includes/common.inc: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -6088,7 +6088,7 @@ function drupal_render_page($page) {
 */
function drupal_render(&$elements) {
  // Early-return nothing if user does not have access.
  if (empty($elements) || (isset($elements['#access']) && !$elements['#access'])) {
  if (empty($elements) || !is_array($elements) || (isset($elements['#access']) && !$elements['#access'])) {
    return '';
  }

+5 −0
Changes for modules/simpletest/tests/common.test: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -1989,6 +1989,11 @@ class DrupalRenderTestCase extends DrupalWebTestCase {
        'value' => '',
        'expected' => '',
      ),
      array(
        'name' => 'not a render array',
        'value' => 'this is not an array',
        'expected' => '',
      ),
      array(
        'name' => 'no access',
        'value' => array(