← Back to team overview

mahara-contributors team mailing list archive

[Bug 1824386] Re: Inappropriate comparison for DB versions

 

** Changed in: mahara
    Milestone: None => 20.10.0

** Changed in: mahara
   Importance: Undecided => Medium

** Changed in: mahara
       Status: In Progress => Fix Committed

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1824386

Title:
  Inappropriate comparison for DB versions

Status in Mahara:
  Fix Committed

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.

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1824386/+subscriptions


References