diff options
author | Dries Buytaert <dries@buytaert.net> | 2005-12-14 20:10:45 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2005-12-14 20:10:45 +0000 |
commit | 764f1177efe7bafe5ab47b21968d4b0921c3896c (patch) | |
tree | b0d25865abedeed7d251bef5c43857e79bc6f210 /modules | |
parent | e53f58fbe0e6c033fce65bd0d7a76d25911ff158 (diff) | |
download | brdo-764f1177efe7bafe5ab47b21968d4b0921c3896c.tar.gz brdo-764f1177efe7bafe5ab47b21968d4b0921c3896c.tar.bz2 |
- Patch #40631 by Chris Johnson: is_array() slower than isset() or empty().
Diffstat (limited to 'modules')
-rw-r--r-- | modules/block.module | 3 | ||||
-rw-r--r-- | modules/block/block.module | 3 | ||||
-rw-r--r-- | modules/comment.module | 4 | ||||
-rw-r--r-- | modules/comment/comment.module | 4 | ||||
-rw-r--r-- | modules/filter.module | 6 | ||||
-rw-r--r-- | modules/filter/filter.module | 6 | ||||
-rw-r--r-- | modules/node.module | 8 | ||||
-rw-r--r-- | modules/node/node.module | 8 | ||||
-rw-r--r-- | modules/search.module | 4 | ||||
-rw-r--r-- | modules/search/search.module | 4 | ||||
-rw-r--r-- | modules/taxonomy.module | 2 | ||||
-rw-r--r-- | modules/taxonomy/taxonomy.module | 2 |
12 files changed, 28 insertions, 26 deletions
diff --git a/modules/block.module b/modules/block.module index d15f3ed4c..ad479f239 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 d15f3ed4c..ad479f239 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 efca38ca5..c4dac7d36 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 efca38ca5..c4dac7d36 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 173c0b253..30fcbae96 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 173c0b253..30fcbae96 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 32a4d98c7..0a7d3b75f 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 32a4d98c7..0a7d3b75f 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 908509da9..2755b19eb 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 908509da9..2755b19eb 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 5b4bd3627..eda75a7b1 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 5b4bd3627..eda75a7b1 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']); |