Index: backup/util/structure/backup_optigroup.class.php =================================================================== RCS file: /cvsroot/moodle/moodle/backup/util/structure/backup_optigroup.class.php,v retrieving revision 1.1 diff -u -r1.1 backup_optigroup.class.php --- backup/util/structure/backup_optigroup.class.php 21 Apr 2010 09:17:10 -0000 1.1 +++ backup/util/structure/backup_optigroup.class.php 1 Nov 2010 14:34:11 -0000 @@ -46,7 +46,7 @@ public function add_child($element) { if (!($element instanceof backup_optigroup_element)) { // parameter must be backup_optigroup_element - if (!$found = get_class($element)) { + if (is_string($element) || !$found = get_class($element)) { $found = 'non object'; } throw new base_optigroup_exception('optigroup_element_incorrect', $found); Index: backup/util/xml/simpletest/testwriter.php =================================================================== RCS file: /cvsroot/moodle/moodle/backup/util/xml/simpletest/testwriter.php,v retrieving revision 1.1 diff -u -r1.1 testwriter.php --- backup/util/xml/simpletest/testwriter.php 21 Apr 2010 09:17:11 -0000 1.1 +++ backup/util/xml/simpletest/testwriter.php 1 Nov 2010 14:34:11 -0000 @@ -303,6 +303,9 @@ $xw->stop(); $result = $xo->get_allcontents(); $fcontents = file_get_contents($CFG->dirroot . '/backup/util/xml/simpletest/fixtures/test1.xml'); + + // Normailse carriage return characters. + $fcontents = preg_replace('/\r\n/', "\n", $fcontents ); $this->assertEqual(trim($result), trim($fcontents)); } }