MDL-61240 dml: php72 compatibility, avoid counting on non-countables
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Thu, 18 Jan 2018 23:59:16 +0000 (00:59 +0100)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Thu, 18 Jan 2018 23:59:16 +0000 (00:59 +0100)
This was not detected earlier because we have been unable to
run sqlsrv + php72 till now (not available).

lib/dml/sqlsrv_native_moodle_database.php

index 08f2735..d1d27f1 100644 (file)
@@ -443,7 +443,7 @@ class sqlsrv_native_moodle_database extends moodle_database {
      * @return array of table names in lowercase and without prefix
      */
     public function get_tables($usecache = true) {
-        if ($usecache and count($this->tables) > 0) {
+        if ($usecache and $this->tables !== null) {
             return $this->tables;
         }
         $this->tables = array ();