diff --git a/cake/libs/model/cake_schema.php b/cake/libs/model/cake_schema.php index 1e3a3d924..5a99bcdd2 100644 --- a/cake/libs/model/cake_schema.php +++ b/cake/libs/model/cake_schema.php @@ -116,6 +116,9 @@ class CakeSchema extends Object { foreach ($data as $key => $val) { if (!empty($val)) { if (!in_array($key, array('plugin', 'name', 'path', 'file', 'connection', 'tables', '_log'))) { + if ($key[0] === '_') { + continue; + } $this->tables[$key] = $val; unset($this->{$key}); } elseif ($key !== 'tables') { diff --git a/cake/tests/cases/libs/model/cake_schema.test.php b/cake/tests/cases/libs/model/cake_schema.test.php index 02278a88e..d22f2b653 100644 --- a/cake/tests/cases/libs/model/cake_schema.test.php +++ b/cake/tests/cases/libs/model/cake_schema.test.php @@ -80,6 +80,14 @@ class MyAppSchema extends CakeSchema { 'indexes' => array('PRIMARY' => array('column' => 'id', 'unique' => true)), ); +/** + * _foo property + * + * @var array + * @access protected + */ + protected $_foo = array('bar'); + /** * setup method * @@ -99,6 +107,19 @@ class MyAppSchema extends CakeSchema { */ function teardown($version) { } + +/** + * getVar method + * + * @param string $var Name of var + * @return mixed + */ + public function getVar($var) { + if (!isset($this->$var)) { + return null; + } + return $this->$var; + } } /** @@ -750,6 +771,8 @@ class CakeSchemaTest extends CakeTestCase { ), ); $this->assertEqual($expected, $compare); + $this->assertNull($New->getVar('comments')); + $this->assertEqual($New->getVar('_foo'), array('bar')); $tables = array( 'missing' => array(