diff options
author | Dries Buytaert <dries@buytaert.net> | 2005-12-05 08:47:24 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2005-12-05 08:47:24 +0000 |
commit | a2d8174cd40578f095c7630b951bf6986560ab58 (patch) | |
tree | 67f1aee8dea43ffc117ba183071658ae9e82674a | |
parent | 77f55aa7f2b04398de3ff4fc43bc2ad3a98eee06 (diff) | |
download | brdo-a2d8174cd40578f095c7630b951bf6986560ab58.tar.gz brdo-a2d8174cd40578f095c7630b951bf6986560ab58.tar.bz2 |
- Patch #39875 by chx: form_sort is broken with PHP5.
-rw-r--r-- | includes/form.inc | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/includes/form.inc b/includes/form.inc index 65c944921..ec4183742 100644 --- a/includes/form.inc +++ b/includes/form.inc @@ -19,7 +19,7 @@ * Check if the key is a property. */ function element_property($key) { - return $key{0} == '#'; + return $key[0] == '#'; } function element_properties($element) { @@ -30,7 +30,7 @@ function element_properties($element) { * Check if the key is a child. */ function element_child($key) { - return $key{0} != '#'; + return $key[0] != '#'; } function element_children($element) { @@ -358,10 +358,9 @@ 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']) { - return 0; - } - return ($a['#weight'] < $b['#weight']) ? -1 : 1; + $a_weight = (is_array($a) && isset($a['#weight'])) ? $a['#weight'] : 0; + $b_weight = (is_array($b) && isset($b['#weight'])) ? $b['#weight'] : 0; + return $a_weight - $b_weight; } /** |