summaryrefslogtreecommitdiff
path: root/includes/form.inc
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2005-12-14 20:10:45 +0000
committerDries Buytaert <dries@buytaert.net>2005-12-14 20:10:45 +0000
commit764f1177efe7bafe5ab47b21968d4b0921c3896c (patch)
treeb0d25865abedeed7d251bef5c43857e79bc6f210 /includes/form.inc
parente53f58fbe0e6c033fce65bd0d7a76d25911ff158 (diff)
downloadbrdo-764f1177efe7bafe5ab47b21968d4b0921c3896c.tar.gz
brdo-764f1177efe7bafe5ab47b21968d4b0921c3896c.tar.bz2
- Patch #40631 by Chris Johnson: is_array() slower than isset() or empty().
Diffstat (limited to 'includes/form.inc')
-rw-r--r--includes/form.inc11
1 files changed, 6 insertions, 5 deletions
diff --git a/includes/form.inc b/includes/form.inc
index fd1dc8482..3af3d1375 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);
}
}