### Eclipse Workspace Patch 1.0
#P moodle
Index: lib/dmllib.php
===================================================================
RCS file: /cvsroot/moodle/moodle/lib/dmllib.php,v
retrieving revision 1.93
diff -u -r1.93 dmllib.php
--- lib/dmllib.php	24 May 2007 08:50:01 -0000	1.93
+++ lib/dmllib.php	28 May 2007 00:38:18 -0000
@@ -1538,7 +1538,7 @@
     // Pull out data matching these fields
     $ddd = array();
     foreach ($columns as $column) {
-        if ($column->name <> 'id' and isset($data[$column->name]) ) {
+        if ($column->name <> 'id' and array_key_exists($column->name, $data)) {
             $ddd[$column->name] = $data[$column->name];
             // PostgreSQL bytea support
             if ($CFG->dbfamily == 'postgres' && $column->type == 'bytea') {
@@ -1557,7 +1557,11 @@
     if ($numddd) {
         foreach ($ddd as $key => $value) {
             $count++;
-            $update .= $key .' = \''. $value .'\'';   // All incoming data is already quoted
+            if ($value === NULL) {
+                $update .= $key .' = NULL'; // previosly NULLs were not updated
+            } else {
+                $update .= $key .' = \''. $value .'\'';   // All incoming data is already quoted
+            }
             if ($count < $numddd) {
                 $update .= ', ';
             }
