]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-15132 fixed broken sql menu functions - thanks Howard
authorskodak <skodak>
Wed, 4 Jun 2008 09:14:17 +0000 (09:14 +0000)
committerskodak <skodak>
Wed, 4 Jun 2008 09:14:17 +0000 (09:14 +0000)
lib/dml/moodle_database.php

index 82d3b47066bb5361efcc349539b39b56e91181e7..18004c53ab954436ea5da4158bcdaf68c3fbec07 100644 (file)
@@ -692,8 +692,9 @@ abstract class moodle_database {
         $menu = array();
         if ($records = $this->get_records_select($table, $select, $params, $sort, $fields, $limitfrom, $limitnum)) {
             foreach ($records as $record) {
-                $key   = array_unshift($record);
-                $value = array_unshift($record);
+                $record = (array)$record;
+                $key   = array_shift($record);
+                $value = array_shift($record);
                 $menu[$key] = $value;
             }
         }
@@ -716,8 +717,9 @@ abstract class moodle_database {
         $menu = array();
         if ($records = $this->get_records_sql($sql, $params, $limitfrom, $limitnum)) {
             foreach ($records as $record) {
-                $key   = array_unshift($record);
-                $value = array_unshift($record);
+                $record = (array)$record;
+                $key   = array_shift($record);
+                $value = array_shift($record);
                 $menu[$key] = $value;
             }
         }