From 8f5112b8d73709ef3e55c4c1b7988109bb1ae54e Mon Sep 17 00:00:00 2001 From: "renan.saddam" Date: Sat, 29 May 2010 12:06:36 -0300 Subject: [PATCH 1/5] Changing break; to continue; so it will process the next tables on the array, tests added. --- cake/libs/model/cake_schema.php | 2 +- .../cases/libs/model/cake_schema.test.php | 39 +++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/cake/libs/model/cake_schema.php b/cake/libs/model/cake_schema.php index adee3df01..7901cdf09 100644 --- a/cake/libs/model/cake_schema.php +++ b/cake/libs/model/cake_schema.php @@ -451,7 +451,7 @@ class CakeSchema extends Object { $tables = array(); foreach ($new as $table => $fields) { if ($table == 'missing') { - break; + continue; } if (!array_key_exists($table, $old)) { $tables[$table]['add'] = $fields; diff --git a/cake/tests/cases/libs/model/cake_schema.test.php b/cake/tests/cases/libs/model/cake_schema.test.php index 664364e3d..c07b9d998 100644 --- a/cake/tests/cases/libs/model/cake_schema.test.php +++ b/cake/tests/cases/libs/model/cake_schema.test.php @@ -743,6 +743,45 @@ class CakeSchemaTest extends CakeTestCase { ), ); $this->assertEqual($expected, $compare); + + $tables = array( + 'missing' => array( + 'categories' => array( + 'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), + 'created' => array('type' => 'datetime', 'null' => false, 'default' => NULL), + 'modified' => array('type' => 'datetime', 'null' => false, 'default' => NULL), + 'name' => array('type' => 'string', 'null' => false, 'default' => NULL, 'length' => 100), + 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)), + 'tableParameters' => array('charset' => 'latin1', 'collate' => 'latin1_swedish_ci', 'engine' => 'MyISAM') + ) + ), + 'ratings' => array( + 'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), + 'foreign_key' => array('type' => 'integer', 'null' => false, 'default' => NULL), + 'model' => array('type' => 'varchar', 'null' => false, 'default' => NULL), + 'value' => array('type' => 'float', 'null' => false, 'length' => '5,2', 'default' => NULL), + 'created' => array('type' => 'datetime', 'null' => false, 'default' => NULL), + 'modified' => array('type' => 'datetime', 'null' => false, 'default' => NULL), + 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)), + 'tableParameters' => array('charset' => 'latin1', 'collate' => 'latin1_swedish_ci', 'engine' => 'MyISAM') + ) + ); + $compare = $New->compare($this->Schema, $tables); + $expected = array( + 'ratings' => array( + 'add' => array( + 'id' => array('type' => 'integer', 'null' => false, 'default' => NULL, 'key' => 'primary'), + 'foreign_key' => array('type' => 'integer', 'null' => false, 'default' => NULL), + 'model' => array('type' => 'varchar', 'null' => false, 'default' => NULL), + 'value' => array('type' => 'float', 'null' => false, 'length' => '5,2', 'default' => NULL), + 'created' => array('type' => 'datetime', 'null' => false, 'default' => NULL), + 'modified' => array('type' => 'datetime', 'null' => false, 'default' => NULL), + 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => 1)), + 'tableParameters' => array('charset' => 'latin1', 'collate' => 'latin1_swedish_ci', 'engine' => 'MyISAM') + ) + ) + ); + $this->assertEqual($expected, $compare); } /** From 25a6a3cac84b34a3d5a93cbca0ec4e1910dc4901 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sat, 29 May 2010 12:47:31 -0400 Subject: [PATCH 2/5] Correcting spacing in file test. Correctly constructing a File object, so testRead does not rely on the previous test to leave the object in the correct state. --- cake/tests/cases/libs/file.test.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/cake/tests/cases/libs/file.test.php b/cake/tests/cases/libs/file.test.php index 10ff17ac0..8cb372eff 100644 --- a/cake/tests/cases/libs/file.test.php +++ b/cake/tests/cases/libs/file.test.php @@ -104,6 +104,9 @@ class FileTest extends CakeTestCase { * @return void */ function testRead() { + $file = __FILE__; + $this->File =& new File($file); + $result = $this->File->read(); $expecting = file_get_contents(__FILE__); $this->assertEqual($result, $expecting); @@ -445,7 +448,7 @@ class FileTest extends CakeTestCase { * @return void */ function _getTmpFile($paintSkip = true) { - $tmpFile = TMP.'tests'.DS.'cakephp.file.test.tmp'; + $tmpFile = TMP . 'tests' . DS . 'cakephp.file.test.tmp'; if (is_writable(dirname($tmpFile)) && (!file_exists($tmpFile) || is_writable($tmpFile))) { return $tmpFile; }; @@ -454,14 +457,14 @@ class FileTest extends CakeTestCase { $caller = 'test'; if (function_exists('debug_backtrace')) { $trace = debug_backtrace(); - $caller = $trace[1]['function'].'()'; + $caller = $trace[1]['function'] . '()'; } $assertLine = new SimpleStackTrace(array(__FUNCTION__)); $assertLine = $assertLine->traceMethod(); $shortPath = substr($tmpFile, strlen(ROOT)); $message = '[FileTest] Skipping %s because "%s" not writeable!'; - $message = sprintf(__($message, true), $caller, $shortPath).$assertLine; + $message = sprintf(__($message, true), $caller, $shortPath) . $assertLine; $this->_reporter->paintSkip($message); } return false; From 7cde3094f0c741abbe6b0b14d8894da343c9bf7b Mon Sep 17 00:00:00 2001 From: mark_story Date: Sat, 29 May 2010 12:50:42 -0400 Subject: [PATCH 3/5] Removing trim() that was performed when reading a file with a lock() enabled. This was causing a failure in php5. --- cake/libs/file.php | 1 - 1 file changed, 1 deletion(-) diff --git a/cake/libs/file.php b/cake/libs/file.php index 2d41d7202..ed0e2334f 100644 --- a/cake/libs/file.php +++ b/cake/libs/file.php @@ -185,7 +185,6 @@ class File extends Object { while (!feof($this->handle)) { $data .= fgets($this->handle, 4096); } - $data = trim($data); if ($this->lock !== null) { flock($this->handle, LOCK_UN); From dea33f64520eb181c0bfcba73201858a9024d720 Mon Sep 17 00:00:00 2001 From: mark_story Date: Sat, 29 May 2010 13:19:12 -0400 Subject: [PATCH 4/5] Fixing pass by reference errors in php5.3. Fixes #451 --- cake/libs/model/model_behavior.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cake/libs/model/model_behavior.php b/cake/libs/model/model_behavior.php index 77a4157ff..140a8831d 100644 --- a/cake/libs/model/model_behavior.php +++ b/cake/libs/model/model_behavior.php @@ -176,7 +176,7 @@ class ModelBehavior extends Object { case 5: return $this->{$method}($model, $params[0], $params[1], $params[2], $params[3], $params[4]); default: - array_unshift($params, $model); + $params = array_merge(array(&$model), $params); return call_user_func_array(array(&$this, $method), $params); break; } From 0180daaad372063f42e4850d0f35ccfc9ce874fb Mon Sep 17 00:00:00 2001 From: mark_story Date: Sat, 29 May 2010 13:26:34 -0400 Subject: [PATCH 5/5] Updating version numbers to 1.3.1 --- cake/VERSION.txt | 3 +-- cake/config/config.php | 2 +- cake/libs/view/pages/home.ctp | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/cake/VERSION.txt b/cake/VERSION.txt index 4276a6cf6..271b0e83c 100644 --- a/cake/VERSION.txt +++ b/cake/VERSION.txt @@ -18,5 +18,4 @@ // @license MIT License (http://www.opensource.org/licenses/mit-license.php) // +--------------------------------------------------------------------------------------------+ // //////////////////////////////////////////////////////////////////////////////////////////////////// -1.3.0 - +1.3.1 diff --git a/cake/config/config.php b/cake/config/config.php index d01327da1..ce6f59afd 100644 --- a/cake/config/config.php +++ b/cake/config/config.php @@ -17,4 +17,4 @@ * @since CakePHP(tm) v 1.1.11.4062 * @license MIT License (http://www.opensource.org/licenses/mit-license.php) */ -return $config['Cake.version'] = '1.3.0'; +return $config['Cake.version'] = '1.3.1'; diff --git a/cake/libs/view/pages/home.ctp b/cake/libs/view/pages/home.ctp index e61349ade..fa2eb4a95 100644 --- a/cake/libs/view/pages/home.ctp +++ b/cake/libs/view/pages/home.ctp @@ -21,7 +21,7 @@ if (Configure::read() == 0): endif; ?>

- + 0): Debugger::checkSecurityKeys();