diff --git a/cake/libs/model/cake_schema.php b/cake/libs/model/cake_schema.php index 43dede8e7..49e542200 100644 --- a/cake/libs/model/cake_schema.php +++ b/cake/libs/model/cake_schema.php @@ -176,7 +176,7 @@ class CakeSchema extends Object { } if (class_exists($class)) { - $Schema =& new $class($options); + $Schema = new $class($options); return $Schema; } $false = false; @@ -204,7 +204,7 @@ class CakeSchema extends Object { ), $options )); - $db =& ConnectionManager::getDataSource($connection); + $db = ConnectionManager::getDataSource($connection); App::import('Model', 'AppModel'); if (isset($this->plugin)) { @@ -232,11 +232,7 @@ class CakeSchema extends Object { if (isset($this->plugin)) { $model = $this->plugin . '.' . $model; } - if (PHP5) { - $Object = ClassRegistry::init(array('class' => $model, 'ds' => null)); - } else { - $Object =& ClassRegistry::init(array('class' => $model, 'ds' => null)); - } + $Object = ClassRegistry::init(array('class' => $model, 'ds' => null)); if (is_object($Object) && $Object->useTable !== false) { $Object->setDataSource($connection); @@ -359,11 +355,9 @@ class CakeSchema extends Object { } $out .= "}\n"; - $File =& new File($path . DS . $file, true); - $header = '$Id'; - $content = ""; - $content = $File->prepare($content); - if ($File->write($content)) { + $file = new SplFileObject($path . DS . $file, 'w+'); + $content = ""; + if ($file->fwrite($content)) { return $content; } return false; @@ -424,7 +418,7 @@ class CakeSchema extends Object { */ public function compare($old, $new = null) { if (empty($new)) { - $new =& $this; + $new = $this; } if (is_array($new)) { if (isset($new['tables'])) { @@ -529,7 +523,7 @@ class CakeSchema extends Object { * @return array Formatted columns */ public function __columns(&$Obj) { - $db =& ConnectionManager::getDataSource($Obj->useDbConfig); + $db = ConnectionManager::getDataSource($Obj->useDbConfig); $fields = $Obj->schema(true); $columns = $props = array(); foreach ($fields as $name => $value) { diff --git a/cake/tests/cases/libs/model/cake_schema.test.php b/cake/tests/cases/libs/model/cake_schema.test.php index 81ced839b..521e9063a 100644 --- a/cake/tests/cases/libs/model/cake_schema.test.php +++ b/cake/tests/cases/libs/model/cake_schema.test.php @@ -730,7 +730,7 @@ class CakeSchemaTest extends CakeTestCase { ), 'posts' => array( 'add' => array( - 'summary' => array('type' => 'text', 'null' => 1), + 'summary' => array('type' => 'text', 'null' => true), ), 'drop' => array( 'tableParameters' => array(), @@ -738,7 +738,7 @@ class CakeSchemaTest extends CakeTestCase { 'change' => array( 'author_id' => array('type' => 'integer', 'null' => true, 'default' => ''), 'title' => array('type' => 'string', 'null' => false, 'default' => 'Title'), - 'published' => array('type' => 'string', 'null' => true, 'default' => 'Y', 'length' => '1') + 'published' => array('type' => 'string', 'null' => true, 'default' => 'Y', 'length' => 1) ) ), );