Inappropriate comparison for DB versions

Bug #1824386 reported by Peter Spicer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Fix Released
Medium
Cecilia Vela Gurovic

Bug Description

Relevant code from htdocs/init.php

    if (is_postgres()) {
        $okversion = '8.3';
        $dbfriendlyname = 'PostgreSQL';
    }
    else if (is_mysql()) {
        $okversion = '5.0.25';
        $dbfriendlyname = 'MySQL';
    }
    if (floatval($dbversion['version']) < floatval($okversion)) {
        throw new ConfigSanityException(get_string('dbversioncheckfailed', 'error', $dbfriendlyname, $dbversion['version'], $okversion));
    }

floatval() on those strings will return, at best, the major version number, and while I think it's unlikely that people are going to be running 19.04 on PGSQL 8.2, right now the system wouldn't be able to detect that.

Switching out to version_compare would be a proper and safe comparison for this.

Revision history for this message
Mahara Bot (dev-mahara) wrote : A patch has been submitted for review

Patch for "master" branch: https://reviews.mahara.org/11069

Changed in mahara:
assignee: nobody → Cecilia Vela Gurovic (ceciliavg)
importance: Undecided → Medium
importance: Medium → Undecided
status: New → In Progress
Revision history for this message
Mahara Bot (dev-mahara) wrote : A change has been merged

Reviewed: https://reviews.mahara.org/11069
Committed: https://git.mahara.org/mahara/mahara/commit/042fb1c77daac5731154ed74882f3392a75415d3
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit 042fb1c77daac5731154ed74882f3392a75415d3
Author: Cecilia Vela Gurovic <email address hidden>
Date: Mon Jul 13 17:54:23 2020 +1200

Bug 1824386: Inappropriate comparison for DB versions

behatnotneeded

Change-Id: I1e5cfc165f2c2776305122606d2eeca208efc4ab

Robert Lyon (robertl-9)
Changed in mahara:
milestone: none → 20.10.0
importance: Undecided → Medium
status: In Progress → Fix Committed
Robert Lyon (robertl-9)
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.