diff --git a/lib/Cake/Controller/Component/CookieComponent.php b/lib/Cake/Controller/Component/CookieComponent.php index 5dcedbc02..5cde7e66f 100644 --- a/lib/Cake/Controller/Component/CookieComponent.php +++ b/lib/Cake/Controller/Component/CookieComponent.php @@ -558,7 +558,7 @@ class CookieComponent extends Component { $first = substr($string, 0, 1); if ($first === '{' || $first === '[') { $ret = json_decode($string, true); - return ($ret) ? $ret : $string; + return ($ret !== null) ? $ret : $string; } $array = array(); foreach (explode(',', $string) as $pair) { diff --git a/lib/Cake/Model/Datasource/Database/Postgres.php b/lib/Cake/Model/Datasource/Database/Postgres.php index 8dca7c7d8..3c6b9089f 100644 --- a/lib/Cake/Model/Datasource/Database/Postgres.php +++ b/lib/Cake/Model/Datasource/Database/Postgres.php @@ -326,7 +326,8 @@ class Postgres extends DboSource { $fullTable = $this->fullTableName($table); $sequence = $this->value($this->getSequence($tableName, $column)); - $this->execute("SELECT setval($sequence, (SELECT MAX(id) FROM $fullTable))"); + $column = $this->name($column); + $this->execute("SELECT setval($sequence, (SELECT MAX($column) FROM $fullTable))"); return true; } diff --git a/lib/Cake/Test/Case/Controller/Component/CookieComponentTest.php b/lib/Cake/Test/Case/Controller/Component/CookieComponentTest.php index 9b0488f57..0fd3558af 100644 --- a/lib/Cake/Test/Case/Controller/Component/CookieComponentTest.php +++ b/lib/Cake/Test/Case/Controller/Component/CookieComponentTest.php @@ -601,12 +601,14 @@ class CookieComponentTest extends CakeTestCase { $_COOKIE['CakeTestCookie'] = array( 'JSON' => '{"name":"value"}', 'Empty' => '', - 'String' => '{"somewhat:"broken"}' + 'String' => '{"somewhat:"broken"}', + 'Array' => '{}' ); $this->assertEquals(array('name' => 'value'), $this->Cookie->read('JSON')); $this->assertEquals('value', $this->Cookie->read('JSON.name')); $this->assertEquals('', $this->Cookie->read('Empty')); $this->assertEquals('{"somewhat:"broken"}', $this->Cookie->read('String')); + $this->assertEquals(array(), $this->Cookie->read('Array')); } /** diff --git a/lib/Cake/View/Helper/PaginatorHelper.php b/lib/Cake/View/Helper/PaginatorHelper.php index fbc6354d5..ca255431b 100644 --- a/lib/Cake/View/Helper/PaginatorHelper.php +++ b/lib/Cake/View/Helper/PaginatorHelper.php @@ -136,7 +136,7 @@ class PaginatorHelper extends AppHelper { /** * Convenience access to any of the paginator params. * - * @param string $key Key of the paginator params array to retreive. + * @param string $key Key of the paginator params array to retrieve. * @param string $model Optional model name. Uses the default if none is specified. * @return mixed Content of the requested param. * @link http://book.cakephp.org/2.0/en/core-libraries/helpers/paginator.html#PaginatorHelper::params