summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xext/pdo/tests/pdo_018.inc147
-rwxr-xr-xext/pdo_mysql/tests/pdo_018.phpt135
-rwxr-xr-xext/pdo_pgsql/tests/pdo_018.phpt135
-rwxr-xr-xext/pdo_sqlite/tests/pdo_018.phpt135
4 files changed, 552 insertions, 0 deletions
diff --git a/ext/pdo/tests/pdo_018.inc b/ext/pdo/tests/pdo_018.inc
new file mode 100755
index 0000000000..993bd688a2
--- /dev/null
+++ b/ext/pdo/tests/pdo_018.inc
@@ -0,0 +1,147 @@
+<?php # vim:ft=php
+
+class TestBase implements Serializeable
+{
+ public $BasePub = 'Public';
+ protected $BasePro = 'Protected';
+ private $BasePri = 'Private';
+
+ function serialize()
+ {
+ $serialized = array();
+ foreach($this as $prop => $val) {
+ $serialized[$prop] = $val;
+ }
+ $serialized = serialize($serialized);
+ echo __METHOD__ . "() = '$serialized'\n";
+ return $serialized;
+ }
+
+ function unserialize($serialized)
+ {
+ echo __METHOD__ . '[' . __LINE__ . ']' . "($serialized)\n";
+ foreach(unserialize($serialized) as $prop => $val) {
+ $this->$prop = '#'.$val;
+ }
+ return true;
+ }
+}
+
+class TestDerived extends TestBase
+{
+ public $BasePub = 'DerivedPublic';
+ protected $BasePro = 'DerivdeProtected';
+ public $DerivedPub = 'Public';
+ protected $DerivedPro = 'Protected';
+ private $DerivedPri = 'Private';
+
+ function serialize()
+ {
+ echo __METHOD__ . "()\n";
+ return TestBase::serialize();
+ }
+
+ function unserialize($serialized)
+ {
+ echo __METHOD__ . "()\n";
+ return TestBase::unserialize($serialized);
+ }
+}
+
+class TestLeaf extends TestDerived
+{
+}
+
+require_once('pdo.inc');
+
+set_sql('create1', 'CREATE TABLE classtypes(id int PRIMARY KEY, name VARCHAR(20) UNIQUE)');
+set_sql('insert1', 'INSERT INTO classtypes VALUES(0, \'stdClass\')');
+set_sql('insert2', 'INSERT INTO classtypes VALUES(1, \'TestBase\')');
+set_sql('insert3', 'INSERT INTO classtypes VALUES(2, \'TestDerived\')');
+set_sql('selectC', 'SELECT COUNT(*) FROM classtypes');
+set_sql('select0', 'SELECT id, name FROM classtypes ORDER by id');
+set_sql('create2', 'CREATE TABLE test(id int PRIMARY KEY, classtype int, val VARCHAR(255))');
+set_sql('insert4', 'INSERT INTO test VALUES(:id, :classtype, :val)');
+set_sql('select1', 'SELECT id FROM classtypes WHERE name=:cname');
+set_sql('select2', 'SELECT test.val FROM test');
+set_sql('select3', 'SELECT classtypes.name AS name, test.val AS val FROM test LEFT JOIN classtypes ON test.classtype=classtypes.id');
+set_sql('select4', 'SELECT COUNT(*) FROM test LEFT JOIN classtypes ON test.classtype=classtypes.id WHERE (classtypes.id IS NULL OR classtypes.id > 0)');
+set_sql('select5', 'SELECT classtypes.name AS name, test.val AS val FROM test LEFT JOIN classtypes ON test.classtype=classtypes.id WHERE (classtypes.id IS NULL OR classtypes.id > 0)');
+
+echo "===INIT===\n";
+$DB->exec($SQL['create1']);
+var_dump($DB->exec($SQL['insert1']));
+var_dump($DB->exec($SQL['insert2']));
+var_dump($DB->exec($SQL['insert3']));
+$DB->exec($SQL['create2']);
+var_dump($DB->query($SQL['selectC'])->fetchSingle());
+var_dump($DB->query($SQL['select0'])->fetchAll(PDO_FETCH_COLUMN|PDO_FETCH_UNIQUE));
+
+$objs = array();
+$objs[0] = new stdClass;
+$objs[1] = new TestBase;
+$objs[2] = new TestDerived;
+$objs[3] = new TestLeaf;
+
+$stmt = $DB->prepare($SQL['select1']);
+$stmt->bindParam(':cname', $cname);
+$stmt->bindColumn('id', $ctype);
+
+$ctypes = array();
+
+foreach($objs as $obj)
+{
+ $cname = get_class($obj);
+ $ctype = NULL; /* set default for non stored class name */
+ $stmt->execute();
+ $stmt->fetch(PDO_FETCH_BOUND);
+ $ctypes[$cname] = $ctype;
+}
+
+echo "===TYPES===\n";
+var_dump($ctypes);
+
+echo "===INSERT===\n";
+$stmt = $DB->prepare($SQL['insert4']);
+$stmt->bindParam(':id', $idx);
+$stmt->bindParam(':classtype', $ctype);
+$stmt->bindParam(':val', $val);
+
+foreach($objs as $idx => $obj)
+{
+ $ctype = $ctypes[get_class($obj)];
+ if (method_exists($obj, 'serialize'))
+ {
+ $val = $obj->serialize();
+ }
+ else
+ {
+ $val = NULL;
+ }
+ $stmt->execute();
+}
+
+echo "===DATA===\n";
+var_dump($DB->query($SQL['select2'])->fetchAll(PDO_FETCH_COLUMN));
+
+echo "===FAILURE===\n";
+try
+{
+ $DB->query($SQL['select3'])->fetchAll(PDO_FETCH_CLASS|PDO_FETCH_CLASSTYPE|PDO_FETCH_SERIALIZE, 'TestLeaf', array());
+}
+catch (PDOException $e)
+{
+ echo 'Exception:';
+ echo $e->getMessage()."\n";
+}
+
+echo "===COUNT===\n";
+var_dump($DB->query($SQL['select4'])->fetchSingle());
+
+echo "===DATABASE===\n";
+var_dump($DB->query($SQL['select5'])->fetchAll(PDO_FETCH_ASSOC));
+
+echo "===FETCHCLASS===\n";
+var_dump($DB->query($SQL['select5'])->fetchAll(PDO_FETCH_CLASS|PDO_FETCH_CLASSTYPE|PDO_FETCH_SERIALIZE, 'TestLeaf'));
+
+?>
diff --git a/ext/pdo_mysql/tests/pdo_018.phpt b/ext/pdo_mysql/tests/pdo_018.phpt
new file mode 100755
index 0000000000..7155216c93
--- /dev/null
+++ b/ext/pdo_mysql/tests/pdo_018.phpt
@@ -0,0 +1,135 @@
+--TEST--
+PDO_MySQL: PDO Unserializing
+--SKIPIF--
+<?php # vim:ft=php
+require_once('skipif.inc');
+?>
+--FILE--
+<?php
+
+require_once('connection.inc');
+require_once('prepare.inc');
+
+require_once($PDO_TESTS . 'pdo_018.inc');
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+===INIT===
+int(1)
+int(1)
+int(1)
+string(1) "3"
+array(3) {
+ [0]=>
+ string(8) "stdClass"
+ [1]=>
+ string(8) "TestBase"
+ [2]=>
+ string(11) "TestDerived"
+}
+===TYPES===
+array(4) {
+ ["stdClass"]=>
+ string(1) "0"
+ ["TestBase"]=>
+ string(1) "1"
+ ["TestDerived"]=>
+ string(1) "2"
+ ["TestLeaf"]=>
+ NULL
+}
+===INSERT===
+TestBase::serialize() = 'a:3:{s:7:"BasePub";s:6:"Public";s:7:"BasePro";s:9:"Protected";s:7:"BasePri";s:7:"Private";}'
+TestDerived::serialize()
+TestBase::serialize() = 'a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";}'
+TestDerived::serialize()
+TestBase::serialize() = 'a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";}'
+===DATA===
+array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ string(91) "a:3:{s:7:"BasePub";s:6:"Public";s:7:"BasePro";s:9:"Protected";s:7:"BasePri";s:7:"Private";}"
+ [2]=>
+ string(144) "a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";}"
+ [3]=>
+ string(144) "a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";}"
+}
+===FAILURE===
+Exception:Class stdClass cannot be unserialized
+===COUNT===
+string(1) "3"
+===DATABASE===
+array(3) {
+ [0]=>
+ array(2) {
+ ["name"]=>
+ string(8) "TestBase"
+ ["val"]=>
+ string(91) "a:3:{s:7:"BasePub";s:6:"Public";s:7:"BasePro";s:9:"Protected";s:7:"BasePri";s:7:"Private";}"
+ }
+ [1]=>
+ array(2) {
+ ["name"]=>
+ string(11) "TestDerived"
+ ["val"]=>
+ string(144) "a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";}"
+ }
+ [2]=>
+ array(2) {
+ ["name"]=>
+ NULL
+ ["val"]=>
+ string(144) "a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";}"
+ }
+}
+===FETCHCLASS===
+TestBase::unserialize[22](a:3:{s:7:"BasePub";s:6:"Public";s:7:"BasePro";s:9:"Protected";s:7:"BasePri";s:7:"Private";})
+TestDerived::unserialize()
+TestBase::unserialize[22](a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";})
+TestDerived::unserialize()
+TestBase::unserialize[22](a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";})
+array(3) {
+ [0]=>
+ object(TestBase)#%d (3) {
+ ["BasePub"]=>
+ string(7) "#Public"
+ ["BasePro:protected"]=>
+ string(10) "#Protected"
+ ["BasePri:private"]=>
+ string(8) "#Private"
+ }
+ [1]=>
+ object(TestDerived)#%d (6) {
+ ["BasePub"]=>
+ string(14) "#DerivedPublic"
+ ["BasePro:protected"]=>
+ string(17) "#DerivdeProtected"
+ ["DerivedPub"]=>
+ string(7) "#Public"
+ ["DerivedPro:protected"]=>
+ string(10) "#Protected"
+ ["DerivedPri:private"]=>
+ string(7) "Private"
+ ["BasePri:private"]=>
+ string(7) "Private"
+ }
+ [2]=>
+ object(TestLeaf)#%d (6) {
+ ["BasePub"]=>
+ string(14) "#DerivedPublic"
+ ["BasePro:protected"]=>
+ string(17) "#DerivdeProtected"
+ ["DerivedPub"]=>
+ string(7) "#Public"
+ ["DerivedPro:protected"]=>
+ string(10) "#Protected"
+ ["DerivedPri:private"]=>
+ string(7) "Private"
+ ["BasePri:private"]=>
+ string(7) "Private"
+ }
+}
+===DONE===
diff --git a/ext/pdo_pgsql/tests/pdo_018.phpt b/ext/pdo_pgsql/tests/pdo_018.phpt
new file mode 100755
index 0000000000..bfb4bb85b8
--- /dev/null
+++ b/ext/pdo_pgsql/tests/pdo_018.phpt
@@ -0,0 +1,135 @@
+--TEST--
+PDO_PGSQL: PDO Unserializing
+--SKIPIF--
+<?php # vim:ft=php
+require_once('skipif.inc');
+?>
+--FILE--
+<?php
+
+require_once('connection.inc');
+require_once('prepare.inc');
+
+require_once($PDO_TESTS . 'pdo_018.inc');
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+===INIT===
+int(1)
+int(1)
+int(1)
+string(1) "3"
+array(3) {
+ [0]=>
+ string(8) "stdClass"
+ [1]=>
+ string(8) "TestBase"
+ [2]=>
+ string(11) "TestDerived"
+}
+===TYPES===
+array(4) {
+ ["stdClass"]=>
+ int(0)
+ ["TestBase"]=>
+ int(1)
+ ["TestDerived"]=>
+ int(2)
+ ["TestLeaf"]=>
+ NULL
+}
+===INSERT===
+TestBase::serialize() = 'a:3:{s:7:"BasePub";s:6:"Public";s:7:"BasePro";s:9:"Protected";s:7:"BasePri";s:7:"Private";}'
+TestDerived::serialize()
+TestBase::serialize() = 'a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";}'
+TestDerived::serialize()
+TestBase::serialize() = 'a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";}'
+===DATA===
+array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ string(91) "a:3:{s:7:"BasePub";s:6:"Public";s:7:"BasePro";s:9:"Protected";s:7:"BasePri";s:7:"Private";}"
+ [2]=>
+ string(144) "a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";}"
+ [3]=>
+ string(144) "a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";}"
+}
+===FAILURE===
+Exception:Class stdClass cannot be unserialized
+===COUNT===
+int(3)
+===DATABASE===
+array(3) {
+ [0]=>
+ array(2) {
+ ["name"]=>
+ string(8) "TestBase"
+ ["val"]=>
+ string(91) "a:3:{s:7:"BasePub";s:6:"Public";s:7:"BasePro";s:9:"Protected";s:7:"BasePri";s:7:"Private";}"
+ }
+ [1]=>
+ array(2) {
+ ["name"]=>
+ string(11) "TestDerived"
+ ["val"]=>
+ string(144) "a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";}"
+ }
+ [2]=>
+ array(2) {
+ ["name"]=>
+ NULL
+ ["val"]=>
+ string(144) "a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";}"
+ }
+}
+===FETCHCLASS===
+TestBase::unserialize[22](a:3:{s:7:"BasePub";s:6:"Public";s:7:"BasePro";s:9:"Protected";s:7:"BasePri";s:7:"Private";})
+TestDerived::unserialize()
+TestBase::unserialize[22](a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";})
+TestDerived::unserialize()
+TestBase::unserialize[22](a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";})
+array(3) {
+ [0]=>
+ object(TestBase)#%d (3) {
+ ["BasePub"]=>
+ string(7) "#Public"
+ ["BasePro:protected"]=>
+ string(10) "#Protected"
+ ["BasePri:private"]=>
+ string(8) "#Private"
+ }
+ [1]=>
+ object(TestDerived)#%d (6) {
+ ["BasePub"]=>
+ string(14) "#DerivedPublic"
+ ["BasePro:protected"]=>
+ string(17) "#DerivdeProtected"
+ ["DerivedPub"]=>
+ string(7) "#Public"
+ ["DerivedPro:protected"]=>
+ string(10) "#Protected"
+ ["DerivedPri:private"]=>
+ string(7) "Private"
+ ["BasePri:private"]=>
+ string(7) "Private"
+ }
+ [2]=>
+ object(TestLeaf)#%d (6) {
+ ["BasePub"]=>
+ string(14) "#DerivedPublic"
+ ["BasePro:protected"]=>
+ string(17) "#DerivdeProtected"
+ ["DerivedPub"]=>
+ string(7) "#Public"
+ ["DerivedPro:protected"]=>
+ string(10) "#Protected"
+ ["DerivedPri:private"]=>
+ string(7) "Private"
+ ["BasePri:private"]=>
+ string(7) "Private"
+ }
+}
+===DONE===
diff --git a/ext/pdo_sqlite/tests/pdo_018.phpt b/ext/pdo_sqlite/tests/pdo_018.phpt
new file mode 100755
index 0000000000..8a7339f983
--- /dev/null
+++ b/ext/pdo_sqlite/tests/pdo_018.phpt
@@ -0,0 +1,135 @@
+--TEST--
+PDO_SQLite: PDO Unserializing
+--SKIPIF--
+<?php # vim:ft=php
+require_once('skipif.inc');
+?>
+--FILE--
+<?php
+
+require_once('connection.inc');
+require_once('prepare.inc');
+
+require_once($PDO_TESTS . 'pdo_018.inc');
+
+?>
+===DONE===
+<?php exit(0); ?>
+--EXPECTF--
+===INIT===
+int(1)
+int(1)
+int(1)
+string(1) "3"
+array(3) {
+ [0]=>
+ string(8) "stdClass"
+ [1]=>
+ string(8) "TestBase"
+ [2]=>
+ string(11) "TestDerived"
+}
+===TYPES===
+array(4) {
+ ["stdClass"]=>
+ string(1) "0"
+ ["TestBase"]=>
+ string(1) "1"
+ ["TestDerived"]=>
+ string(1) "2"
+ ["TestLeaf"]=>
+ NULL
+}
+===INSERT===
+TestBase::serialize() = 'a:3:{s:7:"BasePub";s:6:"Public";s:7:"BasePro";s:9:"Protected";s:7:"BasePri";s:7:"Private";}'
+TestDerived::serialize()
+TestBase::serialize() = 'a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";}'
+TestDerived::serialize()
+TestBase::serialize() = 'a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";}'
+===DATA===
+array(4) {
+ [0]=>
+ NULL
+ [1]=>
+ string(91) "a:3:{s:7:"BasePub";s:6:"Public";s:7:"BasePro";s:9:"Protected";s:7:"BasePri";s:7:"Private";}"
+ [2]=>
+ string(144) "a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";}"
+ [3]=>
+ string(144) "a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";}"
+}
+===FAILURE===
+Exception:Class stdClass cannot be unserialized
+===COUNT===
+string(1) "3"
+===DATABASE===
+array(3) {
+ [0]=>
+ array(2) {
+ ["name"]=>
+ string(8) "TestBase"
+ ["val"]=>
+ string(91) "a:3:{s:7:"BasePub";s:6:"Public";s:7:"BasePro";s:9:"Protected";s:7:"BasePri";s:7:"Private";}"
+ }
+ [1]=>
+ array(2) {
+ ["name"]=>
+ string(11) "TestDerived"
+ ["val"]=>
+ string(144) "a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";}"
+ }
+ [2]=>
+ array(2) {
+ ["name"]=>
+ NULL
+ ["val"]=>
+ string(144) "a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";}"
+ }
+}
+===FETCHCLASS===
+TestBase::unserialize[22](a:3:{s:7:"BasePub";s:6:"Public";s:7:"BasePro";s:9:"Protected";s:7:"BasePri";s:7:"Private";})
+TestDerived::unserialize()
+TestBase::unserialize[22](a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";})
+TestDerived::unserialize()
+TestBase::unserialize[22](a:4:{s:7:"BasePub";s:13:"DerivedPublic";s:7:"BasePro";s:16:"DerivdeProtected";s:10:"DerivedPub";s:6:"Public";s:10:"DerivedPro";s:9:"Protected";})
+array(3) {
+ [0]=>
+ object(TestBase)#%d (3) {
+ ["BasePub"]=>
+ string(7) "#Public"
+ ["BasePro:protected"]=>
+ string(10) "#Protected"
+ ["BasePri:private"]=>
+ string(8) "#Private"
+ }
+ [1]=>
+ object(TestDerived)#%d (6) {
+ ["BasePub"]=>
+ string(14) "#DerivedPublic"
+ ["BasePro:protected"]=>
+ string(17) "#DerivdeProtected"
+ ["DerivedPub"]=>
+ string(7) "#Public"
+ ["DerivedPro:protected"]=>
+ string(10) "#Protected"
+ ["DerivedPri:private"]=>
+ string(7) "Private"
+ ["BasePri:private"]=>
+ string(7) "Private"
+ }
+ [2]=>
+ object(TestLeaf)#%d (6) {
+ ["BasePub"]=>
+ string(14) "#DerivedPublic"
+ ["BasePro:protected"]=>
+ string(17) "#DerivdeProtected"
+ ["DerivedPub"]=>
+ string(7) "#Public"
+ ["DerivedPro:protected"]=>
+ string(10) "#Protected"
+ ["DerivedPri:private"]=>
+ string(7) "Private"
+ ["BasePri:private"]=>
+ string(7) "Private"
+ }
+}
+===DONE===