Commit a2d8174c authored by Dries's avatar Dries
Browse files

- Patch #39875 by chx: form_sort is broken with PHP5.

parent 77f55aa7
......@@ -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;
}
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment