Skip to content

Commit

Permalink
Merge branch 'master' into 2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Sep 26, 2014
2 parents 249dc56 + eac4e3d commit af43bc1
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 56 deletions.
1 change: 1 addition & 0 deletions lib/Cake/Model/Datasource/Database/Postgres.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,7 @@ public function describe($model) {
}
if (
$fields[$c->name]['default'] === 'NULL' ||
$c->default === null ||
preg_match('/nextval\([\'"]?([\w.]+)/', $c->default, $seq)
) {
$fields[$c->name]['default'] = null;
Expand Down
11 changes: 9 additions & 2 deletions lib/Cake/Network/Email/CakeEmail.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@ class CakeEmail {
*/
const MESSAGE_TEXT = 'text';

/**
* Holds the regex pattern for email validation
*
* @var string
*/
const EMAIL_PATTERN = '/^((?:[\p{L}0-9.!#$%&\'*+\/=?^_`{|}~-]+)*@[\p{L}0-9-.]+)$/ui';

/**
* Recipient of the email
*
Expand Down Expand Up @@ -320,7 +327,7 @@ class CakeEmail {
*
* @var string
*/
protected $_emailPattern = '/^((?:[\p{L}0-9.!#$%&\'*+\/=?^_`{|}~-]+)*@[\p{L}0-9-.]+)$/ui';
protected $_emailPattern = self::EMAIL_PATTERN;

/**
* The class name used for email configuration.
Expand Down Expand Up @@ -1291,7 +1298,7 @@ public function reset() {
$this->headerCharset = null;
$this->_attachments = array();
$this->_config = array();
$this->_emailPattern = null;
$this->_emailPattern = self::EMAIL_PATTERN;
return $this;
}

Expand Down
20 changes: 20 additions & 0 deletions lib/Cake/Test/Case/Model/Datasource/Database/PostgresTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1099,6 +1099,26 @@ public function testLimit() {
$this->assertNotContains($scientificNotation, $result);
}

/**
* Test that postgres describes UUID columns correctly.
*
* @return void
*/
public function testDescribeUuid() {
$db = $this->Dbo;
$db->execute('CREATE TABLE test_uuid_describe (id UUID PRIMARY KEY, name VARCHAR(255))');
$data = $db->describe('test_uuid_describe');

$expected = array(
'type' => 'string',
'null' => false,
'default' => null,
'length' => 36,
);
$this->assertSame($expected, $data['id']);
$db->execute('DROP TABLE test_uuid_describe');
}

/**
* Test describe() behavior for timestamp columns.
*
Expand Down

0 comments on commit af43bc1

Please sign in to comment.