diff --git a/includes/common.inc b/includes/common.inc
index 7c676e5e03ff5bfda1a144fcbfbe3ea98aed3f3c..3c56472df9626a0249c65076d0679e403da4311f 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -741,7 +741,7 @@ function format_rss_item($title, $link, $description, $args = array()) {
     if (is_array($value)) {
       if ($value['key']) {
         $output .= ' <'. $value['key'];
-        if (is_array($value['attributes'])) {
+        if (isset($value['attributes']) && is_array($value['attributes'])) {
           $output .= drupal_attributes($value['attributes']);
         }
 
diff --git a/includes/database.inc b/includes/database.inc
index 744284ece93d057a44bed627987ba6ce171e1689..2c3fe975b87bbf0f922bf4b9b04e8d2a4417a37f 100644
--- a/includes/database.inc
+++ b/includes/database.inc
@@ -232,7 +232,7 @@ function _db_rewrite_sql($query = '', $primary_table = 'n', $primary_field = 'ni
   $distinct = FALSE;
   foreach (module_implements('db_rewrite_sql') as $module) {
     $result = module_invoke($module, 'db_rewrite_sql', $query, $primary_table, $primary_field, $args);
-    if (is_array($result)) {
+    if (isset($result) && is_array($result)) {
       if (isset($result['where'])) {
         $where[] .= $result['where'];
       }
diff --git a/includes/file.inc b/includes/file.inc
index 95a08cb290268ad7d15f7f80f7dfd66c8a547475..dbd981bb2ec78f41e4534c73d276e351ccd64236 100644
--- a/includes/file.inc
+++ b/includes/file.inc
@@ -490,7 +490,7 @@ function file_download() {
       if ($headers === -1) {
         drupal_access_denied();
       }
-      elseif (is_array($headers)) {
+      elseif (isset($headers) && is_array($headers)) {
         file_transfer($file, $headers);
       }
     }
diff --git a/includes/form.inc b/includes/form.inc
index fd1dc8482ee5273f212181a9bad255a3693dae5d..3af3d1375e37bdbac44bf6a322749572b86c2625 100644
--- a/includes/form.inc
+++ b/includes/form.inc
@@ -318,10 +318,11 @@ function _form_builder($form_id, $form) {
  *   The rendered HTML form.
  */
 function form_render(&$elements) {
-  $content = '';
-  if (is_array($elements)) {
-    uasort($elements, "_form_sort");
+  if (!isset($elements)) {
+    return NULL;
   }
+  $content = '';
+  uasort($elements, "_form_sort");
 
   if (!$elements['#children']) {
     /* render all the children using a theme function */
@@ -380,11 +381,11 @@ function _element_info($type, $refresh = null) {
     '#tree' => FALSE,
     '#parents' => $parents
   );
-  if ($refresh || !is_array($cache)) {
+  if ($refresh || !isset($cache)) {
     $cache = array();
     foreach (module_implements('elements') as $module) {
       $elements = module_invoke($module, 'elements');
-      if (is_array($elements)) {
+      if (isset($elements) && is_array($elements)) {
         $cache = array_merge_recursive($cache, $elements);
       }
     }
diff --git a/includes/image.inc b/includes/image.inc
index a4cf79b4460b97b001ed99ffe9b426def545bb4f..cea0be011e3d96a61e8825b11c958bcce3b7d092 100644
--- a/includes/image.inc
+++ b/includes/image.inc
@@ -89,7 +89,7 @@ function image_get_info($file) {
   $data = @getimagesize($file);
   $file_size = @filesize($file);
 
-  if (is_array($data)) {
+  if (isset($data) && is_array($data)) {
     $extensions = array('1' => 'gif', '2' => 'jpg', '3' => 'png');
     $extension = array_key_exists($data[2], $extensions) ?  $extensions[$data[2]] : '';
     $details = array('width'     => $data[0],
diff --git a/includes/module.inc b/includes/module.inc
index 748333a35a4934841c1e8bb4b15974f63e475e1f..f4f5907725d78979354e296183646b6ac726c5d5 100644
--- a/includes/module.inc
+++ b/includes/module.inc
@@ -190,7 +190,7 @@ function module_invoke_all() {
   foreach (module_implements($hook) as $module) {
     $function = $module .'_'. $hook;
     $result = call_user_func_array($function, $args);
-    if (is_array($result)) {
+    if (isset($result) && is_array($result)) {
       $return = array_merge($return, $result);
     }
     else if (isset($result)) {
diff --git a/modules/block.module b/modules/block.module
index d15f3ed4c279ec14d5da04f6601eb69465e7d6e2..ad479f239d2890f833e608dc1c9216d910a103ea 100644
--- a/modules/block.module
+++ b/modules/block.module
@@ -599,7 +599,8 @@ function block_list($region) {
         // Check the current throttle status and see if block should be displayed
         // based on server load.
         if (!($block->throttle && (module_invoke('throttle', 'status') > 0))) {
-          if (is_array($array = module_invoke($block->module, 'block', 'view', $block->delta))) {
+          $array = module_invoke($block->module, 'block', 'view', $block->delta);
+          if (isset($array) && is_array($array)) {
             foreach ($array as $k => $v) {
               $block->$k = $v;
             }
diff --git a/modules/block/block.module b/modules/block/block.module
index d15f3ed4c279ec14d5da04f6601eb69465e7d6e2..ad479f239d2890f833e608dc1c9216d910a103ea 100644
--- a/modules/block/block.module
+++ b/modules/block/block.module
@@ -599,7 +599,8 @@ function block_list($region) {
         // Check the current throttle status and see if block should be displayed
         // based on server load.
         if (!($block->throttle && (module_invoke('throttle', 'status') > 0))) {
-          if (is_array($array = module_invoke($block->module, 'block', 'view', $block->delta))) {
+          $array = module_invoke($block->module, 'block', 'view', $block->delta);
+          if (isset($array) && is_array($array)) {
             foreach ($array as $k => $v) {
               $block->$k = $v;
             }
diff --git a/modules/comment.module b/modules/comment.module
index efca38ca5025ecf19ae14c7712b2d4ca70dd7ff4..c4dac7d36dfb41eb7874e6a02dc9c00439673011 100644
--- a/modules/comment.module
+++ b/modules/comment.module
@@ -1112,7 +1112,7 @@ function theme_comment_admin_overview($form) {
   $header = array(NULL, t('Subject'), t('Author'), t('Time'), t('Operations'));
 
   $output = form_render($form['options']);
-  if (is_array($form['subject'])) {
+  if (isset($form['subject']) && is_array($form['subject'])) {
     foreach (element_children($form['subject']) as $key) {
       $row = array();
       $row[] = form_render($form['comments'][$key]);
@@ -1657,7 +1657,7 @@ function comment_invoke_comment(&$comment, $op) {
   foreach (module_implements('comment') as $name) {
     $function = $name .'_comment';
     $result = $function($comment, $op);
-    if (is_array($result)) {
+    if (isset($result) && is_array($result)) {
       $return = array_merge($return, $result);
     }
     else if (isset($result)) {
diff --git a/modules/comment/comment.module b/modules/comment/comment.module
index efca38ca5025ecf19ae14c7712b2d4ca70dd7ff4..c4dac7d36dfb41eb7874e6a02dc9c00439673011 100644
--- a/modules/comment/comment.module
+++ b/modules/comment/comment.module
@@ -1112,7 +1112,7 @@ function theme_comment_admin_overview($form) {
   $header = array(NULL, t('Subject'), t('Author'), t('Time'), t('Operations'));
 
   $output = form_render($form['options']);
-  if (is_array($form['subject'])) {
+  if (isset($form['subject']) && is_array($form['subject'])) {
     foreach (element_children($form['subject']) as $key) {
       $row = array();
       $row[] = form_render($form['comments'][$key]);
@@ -1657,7 +1657,7 @@ function comment_invoke_comment(&$comment, $op) {
   foreach (module_implements('comment') as $name) {
     $function = $name .'_comment';
     $result = $function($comment, $op);
-    if (is_array($result)) {
+    if (isset($result) && is_array($result)) {
       $return = array_merge($return, $result);
     }
     else if (isset($result)) {
diff --git a/modules/filter.module b/modules/filter.module
index 173c0b253100e92b6aeac96f3ec8f011e1a8675c..30fcbae966cc0ba57084d1c1d2ac8506d408fd6f 100644
--- a/modules/filter.module
+++ b/modules/filter.module
@@ -556,7 +556,7 @@ function filter_admin_configure() {
   $form = array();
   foreach ($list as $filter) {
     $form_module = module_invoke($filter->module, 'filter', 'settings', $filter->delta, $format);
-    if (is_array($form_module)) {
+    if (isset($form_module) && is_array($form_module)) {
       $form = array_merge($form, $form_module);
     }
   }
@@ -613,7 +613,7 @@ function filter_list_all() {
 
   foreach (module_list() as $module) {
     $list = module_invoke($module, 'filter', 'list');
-    if (is_array($list)) {
+    if (isset($list) && is_array($list)) {
       foreach ($list as $delta => $name) {
         $filters[$module .'/'. $delta] = (object)array('module' => $module, 'delta' => $delta, 'name' => $name);
       }
@@ -655,7 +655,7 @@ function filter_list_format($format) {
     $result = db_query("SELECT * FROM {filters} WHERE format = %d ORDER BY weight ASC", $format);
     while ($filter = db_fetch_object($result)) {
       $list = module_invoke($filter->module, 'filter', 'list');
-      if (is_array($list) && isset($list[$filter->delta])) {
+      if (isset($list) && is_array($list) && isset($list[$filter->delta])) {
         $filter->name = $list[$filter->delta];
         $filters[$format][$filter->module .'/'. $filter->delta] = $filter;
       }
diff --git a/modules/filter/filter.module b/modules/filter/filter.module
index 173c0b253100e92b6aeac96f3ec8f011e1a8675c..30fcbae966cc0ba57084d1c1d2ac8506d408fd6f 100644
--- a/modules/filter/filter.module
+++ b/modules/filter/filter.module
@@ -556,7 +556,7 @@ function filter_admin_configure() {
   $form = array();
   foreach ($list as $filter) {
     $form_module = module_invoke($filter->module, 'filter', 'settings', $filter->delta, $format);
-    if (is_array($form_module)) {
+    if (isset($form_module) && is_array($form_module)) {
       $form = array_merge($form, $form_module);
     }
   }
@@ -613,7 +613,7 @@ function filter_list_all() {
 
   foreach (module_list() as $module) {
     $list = module_invoke($module, 'filter', 'list');
-    if (is_array($list)) {
+    if (isset($list) && is_array($list)) {
       foreach ($list as $delta => $name) {
         $filters[$module .'/'. $delta] = (object)array('module' => $module, 'delta' => $delta, 'name' => $name);
       }
@@ -655,7 +655,7 @@ function filter_list_format($format) {
     $result = db_query("SELECT * FROM {filters} WHERE format = %d ORDER BY weight ASC", $format);
     while ($filter = db_fetch_object($result)) {
       $list = module_invoke($filter->module, 'filter', 'list');
-      if (is_array($list) && isset($list[$filter->delta])) {
+      if (isset($list) && is_array($list) && isset($list[$filter->delta])) {
         $filter->name = $list[$filter->delta];
         $filters[$format][$filter->module .'/'. $filter->delta] = $filter;
       }
diff --git a/modules/node.module b/modules/node.module
index 32a4d98c7644994d1ec15c9e0268bb8b9f4d4860..0a7d3b75f60bf606e470a7fc4175a80db9e4c098 100644
--- a/modules/node.module
+++ b/modules/node.module
@@ -315,7 +315,7 @@ function node_invoke_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
   foreach (module_implements('nodeapi') as $name) {
     $function = $name .'_nodeapi';
     $result = $function($node, $op, $a3, $a4);
-    if (is_array($result)) {
+    if (isset($result) && is_array($result)) {
       $return = array_merge($return, $result);
     }
     else if (isset($result)) {
@@ -751,10 +751,10 @@ function node_search($op = 'search', $keys = null) {
     case 'post':
       // Insert extra restrictions into the search keywords string.
       $edit = &$_POST['edit'];
-      if (is_array($edit['type'])) {
+      if (isset($edit['type']) && is_array($edit['type'])) {
         $keys = search_query_insert($keys, 'type', implode(',', array_keys($edit['type'])));
       }
-      if (is_array($edit['category'])) {
+      if (isset($edit['category']) && is_array($edit['category'])) {
         $keys = search_query_insert($keys, 'category', implode(',', $edit['category']));
       }
       if ($edit['or'] != '') {
@@ -1172,7 +1172,7 @@ function theme_node_admin_nodes($form) {
   $header = array(NULL, t('Title'), t('Type'), t('Author'), t('Status'), t('Operations'));
 
   $output .= form_render($form['options']);
-  if (is_array($form['title'])) {
+  if (isset($form['title']) && is_array($form['title'])) {
     foreach (element_children($form['title']) as $key) {
       $row = array();
       $row[] = form_render($form['nodes'][$key]);
diff --git a/modules/node/node.module b/modules/node/node.module
index 32a4d98c7644994d1ec15c9e0268bb8b9f4d4860..0a7d3b75f60bf606e470a7fc4175a80db9e4c098 100644
--- a/modules/node/node.module
+++ b/modules/node/node.module
@@ -315,7 +315,7 @@ function node_invoke_nodeapi(&$node, $op, $a3 = NULL, $a4 = NULL) {
   foreach (module_implements('nodeapi') as $name) {
     $function = $name .'_nodeapi';
     $result = $function($node, $op, $a3, $a4);
-    if (is_array($result)) {
+    if (isset($result) && is_array($result)) {
       $return = array_merge($return, $result);
     }
     else if (isset($result)) {
@@ -751,10 +751,10 @@ function node_search($op = 'search', $keys = null) {
     case 'post':
       // Insert extra restrictions into the search keywords string.
       $edit = &$_POST['edit'];
-      if (is_array($edit['type'])) {
+      if (isset($edit['type']) && is_array($edit['type'])) {
         $keys = search_query_insert($keys, 'type', implode(',', array_keys($edit['type'])));
       }
-      if (is_array($edit['category'])) {
+      if (isset($edit['category']) && is_array($edit['category'])) {
         $keys = search_query_insert($keys, 'category', implode(',', $edit['category']));
       }
       if ($edit['or'] != '') {
@@ -1172,7 +1172,7 @@ function theme_node_admin_nodes($form) {
   $header = array(NULL, t('Title'), t('Type'), t('Author'), t('Status'), t('Operations'));
 
   $output .= form_render($form['options']);
-  if (is_array($form['title'])) {
+  if (isset($form['title']) && is_array($form['title'])) {
     foreach (element_children($form['title']) as $key) {
       $row = array();
       $row[] = form_render($form['nodes'][$key]);
diff --git a/modules/search.module b/modules/search.module
index 908509da962e95ffda2f480b293ba4cbfa2f667d..2755b19eb96e33d3f2a34846105ae3d71970daca 100644
--- a/modules/search.module
+++ b/modules/search.module
@@ -975,7 +975,7 @@ function search_form($action = '', $keys = '', $type = null, $prompt = null) {
   $form['basic']['inline']['submit'] = array('#type' => 'submit', '#value' => t('Search'));
 
   $form_module = module_invoke($type, 'search', 'form', $keys);
-  if (is_array($form_module)) {
+  if (isset($form_module) && is_array($form_module)) {
     $form = array_merge($form, $form_module);
   }
 
@@ -991,7 +991,7 @@ function search_data($keys = NULL, $type = 'node') {
   if (isset($keys)) {
     if (module_hook($type, 'search')) {
       $results = module_invoke($type, 'search', 'search', $keys);
-      if (is_array($results) && count($results)) {
+      if (isset($results) && is_array($results) && count($results)) {
         $output .= '<dl class="search-results">';
         foreach ($results as $entry) {
           $output .= theme('search_item', $entry, $type);
diff --git a/modules/search/search.module b/modules/search/search.module
index 908509da962e95ffda2f480b293ba4cbfa2f667d..2755b19eb96e33d3f2a34846105ae3d71970daca 100644
--- a/modules/search/search.module
+++ b/modules/search/search.module
@@ -975,7 +975,7 @@ function search_form($action = '', $keys = '', $type = null, $prompt = null) {
   $form['basic']['inline']['submit'] = array('#type' => 'submit', '#value' => t('Search'));
 
   $form_module = module_invoke($type, 'search', 'form', $keys);
-  if (is_array($form_module)) {
+  if (isset($form_module) && is_array($form_module)) {
     $form = array_merge($form, $form_module);
   }
 
@@ -991,7 +991,7 @@ function search_data($keys = NULL, $type = 'node') {
   if (isset($keys)) {
     if (module_hook($type, 'search')) {
       $results = module_invoke($type, 'search', 'search', $keys);
-      if (is_array($results) && count($results)) {
+      if (isset($results) && is_array($results) && count($results)) {
         $output .= '<dl class="search-results">';
         foreach ($results as $entry) {
           $output .= theme('search_item', $entry, $type);
diff --git a/modules/taxonomy.module b/modules/taxonomy.module
index 5b4bd3627d766b056467bc48dd2066555245e61d..eda75a7b10ad5f4ef8bd2a14f936214c8d1411d8 100644
--- a/modules/taxonomy.module
+++ b/modules/taxonomy.module
@@ -596,7 +596,7 @@ function taxonomy_node_save($nid, $terms) {
 
   // Free tagging vocabularies do not send their tids in the form,
   // so we'll detect them here and process them independently.
-  if ($terms['tags']) {
+  if (isset($terms['tags'])) {
     $typed_input = $terms['tags'];
     unset($terms['tags']);
 
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module
index 5b4bd3627d766b056467bc48dd2066555245e61d..eda75a7b10ad5f4ef8bd2a14f936214c8d1411d8 100644
--- a/modules/taxonomy/taxonomy.module
+++ b/modules/taxonomy/taxonomy.module
@@ -596,7 +596,7 @@ function taxonomy_node_save($nid, $terms) {
 
   // Free tagging vocabularies do not send their tids in the form,
   // so we'll detect them here and process them independently.
-  if ($terms['tags']) {
+  if (isset($terms['tags'])) {
     $typed_input = $terms['tags'];
     unset($terms['tags']);
 
diff --git a/themes/bluemarine/page.tpl.php b/themes/bluemarine/page.tpl.php
index 3039ce7fb165b378c95b107181f63fa34fc7a72d..9683955bf2638bc99847e6e31a54cbeb996e18f2 100644
--- a/themes/bluemarine/page.tpl.php
+++ b/themes/bluemarine/page.tpl.php
@@ -18,8 +18,8 @@
       <?php if ($site_slogan) { ?><div class='site-slogan'><?php print $site_slogan ?></div><?php } ?>
     </td>
     <td id="menu">
-      <?php if ($secondary_links) { ?><div id="secondary"><?php print theme('links', $secondary_links) ?></div><?php } ?>
-      <?php if ($primary_links) { ?><div id="primary"><?php print theme('links', $primary_links) ?></div><?php } ?>
+      <?php if (isset($secondary_links)) { ?><div id="secondary"><?php print theme('links', $secondary_links) ?></div><?php } ?>
+      <?php if (isset($primary_links)) { ?><div id="primary"><?php print theme('links', $primary_links) ?></div><?php } ?>
       <?php print $search_box ?>
     </td>
   </tr>
diff --git a/themes/chameleon/chameleon.theme b/themes/chameleon/chameleon.theme
index 0eb915658e04db8627f848368f85bbf7011480d2..54def5f6e51231711b2095c0a77f5a9b86368a9f 100644
--- a/themes/chameleon/chameleon.theme
+++ b/themes/chameleon/chameleon.theme
@@ -55,12 +55,12 @@ function chameleon_page($content) {
 
   $primary_links = theme('links', menu_primary_links());
   $secondary_links = theme('links', menu_secondary_links());
-  if ($primary_links || $secondary_links) {
+  if (isset($primary_links) || isset($secondary_links)) {
     $output .= ' <div class="navlinks">';
-    if ($primary_links) {
+    if (isset($primary_links)) {
       $output .= '<div class="primary">'. $primary_links .'</div>';
     }
-    if ($secondary_links) {
+    if (($secondary_links)) {
       $output .= '<div class="secondary">'. $secondary_links .'</div>';
     }
     $output .= " </div>\n";
diff --git a/themes/pushbutton/page.tpl.php b/themes/pushbutton/page.tpl.php
index e64e8569c9d51c65c3bf899788d072a6d3312c76..c986023cac8fb220fd05dcc663d0532167fdb4bf 100644
--- a/themes/pushbutton/page.tpl.php
+++ b/themes/pushbutton/page.tpl.php
@@ -102,12 +102,12 @@
 <table id="footer-menu" summary="Navigation elements." border="0" cellpadding="0" cellspacing="0" width="100%">
   <tr>
     <td align="center" valign="middle">
-    <?php if (is_array($primary_links)) : ?>
+    <?php if (isset($primary_links)) : ?>
       <div class="primary-links">
         <?php print theme('links', $primary_links) ?>
       </div>
     <?php endif; ?>
-    <?php if (is_array($secondary_links)) : ?>
+    <?php if (isset($secondary_links)) : ?>
       <div class="secondary-links">
         <?php print theme('links', $secondary_links) ?>
       </div>