diff options
author | Dries Buytaert <dries@buytaert.net> | 2005-12-05 21:21:49 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2005-12-05 21:21:49 +0000 |
commit | 0f80b09a4a0aa268279efe24bdb7be57f934da36 (patch) | |
tree | 91dcdd2da8791b734fc1df4e07503e41409688e2 /includes | |
parent | c4c5ce122d1739abaf398d2a8c8d4ef825cd61a0 (diff) | |
download | brdo-0f80b09a4a0aa268279efe24bdb7be57f934da36.tar.gz brdo-0f80b09a4a0aa268279efe24bdb7be57f934da36.tar.bz2 |
- Patch #39875 by chx: make form sorting work with PHP5.
Diffstat (limited to 'includes')
-rw-r--r-- | includes/form.inc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/includes/form.inc b/includes/form.inc index 65c944921..a11d95692 100644 --- a/includes/form.inc +++ b/includes/form.inc @@ -358,10 +358,12 @@ function form_render(&$elements) { * Function used by uasort in form render to sort form via weight. */ function _form_sort($a, $b) { - if ($a['#weight'] == $b['#weight']) { + $a_weight = (is_array($a) && isset($a['#weight'])) ? $a['#weight'] : 0; + $b_weight = (is_array($b) && isset($b['#weight'])) ? $b['#weight'] : 0; + if ($a_weight == $b_weight) { return 0; } - return ($a['#weight'] < $b['#weight']) ? -1 : 1; + return ($a_weight < $b_weight) ? -1 : 1; } /** |