Commit 6e73ca3c authored by Chris Graham's avatar Chris Graham
Browse files

Fixed MANTIS-4439 (Support PHP 8)

parent 020e8f74
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1691,7 +1691,7 @@ function check_expression($e, $assignment = false, $equate_false = false, $funct
        return $type;
    }
    if ((in_array($e[0], array('DIVIDE', 'REMAINDER', 'DIV_EQUAL'))) && ($e[2][0] != 'LITERAL')) {
        if (($assignment) && (@count($e[2][1][2]) == 0)) {
        if (($assignment) && (@is_array($e[2][1][2])) && (empty($e[2][1][2]))) {
            $GLOBALS['LOCAL_VARIABLES'][$e[2][1][1]]['conditioner'][] = '_divide_';
        } elseif (isset($GLOBALS['PEDANTIC'])) {
            log_warning('Divide by zero un-handled', $c_pos);
@@ -1811,7 +1811,7 @@ function check_expression($e, $assignment = false, $equate_false = false, $funct
        if ($x[1][0] == 'EMBEDDED_ASSIGNMENT') {
            $x = $e[1];
        }
        if (($x[1][0] == 'VARIABLE') && (@count($x[1][1][2]) == 0) && ($e[2][0] == 'LITERAL')) {
        if (($x[1][0] == 'VARIABLE') && (@is_array($x[1][1][2])) && (empty($x[1][1][2])) && ($e[2][0] == 'LITERAL')) {
            if (in_array($e[0], array('IS_IDENTICAL', 'IS_NOT_IDENTICAL'))) {
                if (($e[2][1][0] == 'BOOLEAN') && (!$e[2][1][1])) {
                    $GLOBALS['LOCAL_VARIABLES'][$x[1][1][1]]['conditioned_false'] = true;
@@ -1863,7 +1863,7 @@ function check_expression($e, $assignment = false, $equate_false = false, $funct
            }
            if ($assignment) {
                $GLOBALS['MADE_CALL'] = $inner[1];
                if ((@$e[2][0][0] == 'VARIABLE') && (@count($e[2][0][1][2]) == 0) && ($e[1] == 'is_null')) {
                if ((@$e[2][0][0] == 'VARIABLE') && (@is_array($e[2][0][1][2])) && (empty($e[2][0][1][2])) && ($e[1] == 'is_null')) {
                    $GLOBALS['LOCAL_VARIABLES'][$e[2][0][1][1]]['conditioned_null'] = true;
                }
            } else {
+2 −2
Original line number Diff line number Diff line
@@ -400,7 +400,7 @@ class filtering_test_set extends cms_test_case
            list($extra_select, $extra_join, $extra_where) = filtercode_to_sql($GLOBALS['SITE_DB'], parse_filtercode($filter), 'temp_test');
            $sql = 'SELECT r.id' . implode('', $extra_select) . ' FROM ' . get_table_prefix() . 'temp_test r' . implode('', $extra_join) . ' WHERE 1=1' . $extra_where;
            $results = collapse_1d_complexity('id', $GLOBALS['SITE_DB']->query($sql));
            $this->assertTrue($results == $filter_expected, 'Failed Filtercode check for: ' . $filter . ', got: ' . implode(',', array_map('strval', $results)) . '; query: ' . $sql);
            $this->assertTrue($results == $filter_expected, 'Failed Filtercode check for: ' . str_replace('%', '%%', $filter) . ', got: ' . implode(',', array_map('strval', $results)) . '; query: ' . str_replace('%', '%%', $sql));
        }

        // Test using POST environment
@@ -434,7 +434,7 @@ class filtering_test_set extends cms_test_case
            list($extra_select, $extra_join, $extra_where) = filtercode_to_sql($GLOBALS['SITE_DB'], parse_filtercode($filter), 'temp_test');
            $sql = 'SELECT r.id' . implode('', $extra_select) . ' FROM ' . get_table_prefix() . 'temp_test r' . implode('', $extra_join) . ' WHERE 1=1' . $extra_where;
            $results = collapse_1d_complexity('id', $GLOBALS['SITE_DB']->query($sql));
            $this->assertTrue($results == $filter_expected, 'Failed Filtercode check for: ' . $filter . ', got: ' . implode(',', array_map('strval', $results)) . ', expected: ' . implode(',', array_map('strval', $filter_expected)) . ', with: ' . $sql);
            $this->assertTrue($results == $filter_expected, 'Failed Filtercode check for: ' . str_replace('%', '%%', $filter) . ', got: ' . implode(',', array_map('strval', $results)) . ', expected: ' . implode(',', array_map('strval', $filter_expected)) . ', with: ' . str_replace('%', '%%', $sql));
        }

        // Test automatic filter form seems okay
+1 −1
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ if (!is_file($FILE_BASE . '/sources/global.php')) {
}
@chdir($FILE_BASE);

if (@get_magic_quotes_gpc()) {
if ((function_exists('get_magic_quotes_gpc')) && (@get_magic_quotes_gpc())) {
    foreach ($_POST as $key => $val) {
        if (is_array($val)) {
            $_POST[$key] = array_map('stripslashes', $val);
+1 −1
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ function qr_get_domain()
}

$target = $_GET['url'];
if (@get_magic_quotes_gpc()) {
if ((function_exists('get_magic_quotes_gpc')) && (@get_magic_quotes_gpc())) {
    $target = stripslashes($target);
}
$target = str_replace(array("\r", "\n"), array('', ''), $target);
+1 −1
Original line number Diff line number Diff line
@@ -164,7 +164,7 @@ $next_offset_url = '';
if ($file_offset + $per_cycle < count($todo)) {
    $next_offset_url = 'upgrader2.php?';
    foreach ($_GET as $key => $val) {
        if (@get_magic_quotes_gpc()) {
        if ((function_exists('get_magic_quotes_gpc')) && (@get_magic_quotes_gpc())) {
            $val = stripslashes($val);
        }

Loading