Commit 7ff07a9f authored by Chris Graham's avatar Chris Graham
Browse files

Fixed MANTIS-4352 (Crash on PHP 5.x versions in some situations)

parent 7a29a2f1
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1374,7 +1374,7 @@ function sort_maps_by__strlen($rows, $sort_key)
        return;
    }

    @uasort($rows, '_strlen_sort'); // @ is to stop PHP bug warning about altered array contents when Tempcode copies are evaluated internally
    @uasort($rows, '_strlen_sort'); // LEGACY (< PHP 7): @ is to stop PHP bug (https://bugs.php.net/bug.php?id=50688 / https://github.com/php/php-src/commit/179c8a2a09a993bfa35f65828d40b68e3f69f64e#diff-497f073aa1ab88afcb8b248fc25d2a12) warning about altered array contents when Tempcode copies are evaluated internally
}

/**
@@ -1432,9 +1432,9 @@ function sort_maps_by(&$rows, $sort_keys, $preserve_order_if_possible = false, $

        $first_key = key($rows);
        if ((is_integer($first_key)) && (array_unique(array_map('is_integer', array_keys($rows))) === array(true))) {
            usort($rows, '_multi_sort');
            @usort($rows, '_multi_sort'); // LEGACY (< PHP 7): @ is to stop PHP bug (https://bugs.php.net/bug.php?id=50688 / https://github.com/php/php-src/commit/179c8a2a09a993bfa35f65828d40b68e3f69f64e#diff-497f073aa1ab88afcb8b248fc25d2a12) warning about altered array contents when Tempcode copies are evaluated internally
        } else {
            uasort($rows, '_multi_sort');
            @uasort($rows, '_multi_sort'); // LEGACY (< PHP 7): @ is to stop PHP bug (https://bugs.php.net/bug.php?id=50688 / https://github.com/php/php-src/commit/179c8a2a09a993bfa35f65828d40b68e3f69f64e#diff-497f073aa1ab88afcb8b248fc25d2a12) warning about altered array contents when Tempcode copies are evaluated internally
        }
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -109,7 +109,7 @@ class Hook_fields_member_multi

        $auto_sort = option_value_from_field_array($field, 'auto_sort', 'off');
        if ($auto_sort == 'on') {
            @uasort($out, 'strnatcmp');
            uasort($out, 'strnatcmp');
        }

        $ret = new Tempcode();
+1 −1
Original line number Diff line number Diff line
@@ -101,7 +101,7 @@ class Hook_fields_upload_multi

        $auto_sort = option_value_from_field_array($field, 'auto_sort', 'off');
        if ($auto_sort == 'on') {
            @uasort($out, 'strnatcmp');
            uasort($out, 'strnatcmp');
        }

        $ret = new Tempcode();
+1 −1
Original line number Diff line number Diff line
@@ -104,7 +104,7 @@ class Hook_fields_url_multi

        $auto_sort = option_value_from_field_array($field, 'auto_sort', 'off');
        if ($auto_sort == 'on') {
            @uasort($out, 'strnatcmp');
            uasort($out, 'strnatcmp');
        }

        $ret = new Tempcode();