diff --git a/build.xml b/build.xml
index 9759aec9b..daf292fab 100644
--- a/build.xml
+++ b/build.xml
@@ -40,6 +40,9 @@
+
+
+
@@ -205,10 +208,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/lib/Cake/Model/Model.php b/lib/Cake/Model/Model.php
index 75a7c131f..85913ee12 100644
--- a/lib/Cake/Model/Model.php
+++ b/lib/Cake/Model/Model.php
@@ -1752,6 +1752,10 @@ class Model extends Object implements CakeEventListener {
$this->_saveMulti($joined, $this->id, $db);
}
+ if ($success && $count === 0) {
+ $success = false;
+ }
+
if ($success && $count > 0) {
if (!empty($this->data)) {
if ($created) {
diff --git a/lib/Cake/Test/Case/Model/ModelWriteTest.php b/lib/Cake/Test/Case/Model/ModelWriteTest.php
index 0a862d783..05d9a1db4 100644
--- a/lib/Cake/Test/Case/Model/ModelWriteTest.php
+++ b/lib/Cake/Test/Case/Model/ModelWriteTest.php
@@ -24,6 +24,24 @@ require_once dirname(__FILE__) . DS . 'ModelTestBase.php';
*/
class ModelWriteTest extends BaseModelTest {
+/**
+ * Test save() failing when there is no data.
+ *
+ * @return void
+ */
+ public function testInsertNoData() {
+ $this->loadFixtures('Bid');
+ $Bid = ClassRegistry::init('Bid');
+
+ $this->assertFalse($Bid->save());
+
+ $result = $Bid->save(array('Bid' => array()));
+ $this->assertFalse($result);
+
+ $result = $Bid->save(array('Bid' => array('not in schema' => 1)));
+ $this->assertFalse($result);
+ }
+
/**
* testInsertAnotherHabtmRecordWithSameForeignKey method
*