Skip to content

Commit

Permalink
Merge branch '3.2.x' into 3.2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeyklay committed Jul 17, 2017
2 parents a6fdcff + 5b849ec commit eb8c441
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 29 deletions.
28 changes: 16 additions & 12 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# [3.2.2](https://github.com/phalcon/cphalcon/releases/tag/v3.2.2) (2017-XX-XX)
- Added delimiters to escape reserverd words in `Phalcon\Paginator\Adapter\QueryBuilder` method `getPaginate` [#12950](https://github.com/phalcon/cphalcon/issues/12950)
- Fixed `Phalcon\Db\Adapter\Pdo\Postgresql::describeColumns` to work properly with `DOUBLE PRECISION` and `REAL` data types [#12842](https://github.com/phalcon/cphalcon/issues/12842)
- Fixed `Phalcon\Paginator\Adapter\QueryBuilder::getPaginate` to use the db connection service of the model [#12957](https://github.com/phalcon/cphalcon/issues/12957)
- Fixed `Phalcon\Paginator\Adapter\QueryBuilder::getPaginate` to escape reserverd words [#12950](https://github.com/phalcon/cphalcon/issues/12950)


# [3.2.1](https://github.com/phalcon/cphalcon/releases/tag/v3.2.1) (2017-07-10)
- Added `Phalcon\Db\Dialect\Mysql::getForeignKeyChecks` to generate a SQL to check the foreign key settings [#2604](https://github.com/phalcon/cphalcon/issues/2604), [phalcon/phalcon-devtools#556](https://github.com/phalcon/phalcon-devtools/issues/556)
Expand Down Expand Up @@ -32,7 +35,8 @@
- Added ability to sanitize special characters to `Phalcon\Filter`
- Added a new `Phalcon\Mvc\Model\Binder::findBoundModel` method. Params fetched from cache are being added to `internalCache` class property in `Phalcon\Mvc\Model\Binder::getParamsFromCache`
- Added `Phalcon\Mvc\Model\Criteria::createBuilder` to create a query builder from criteria
- Added `dispatcher::beforeForward` event to allow forwarding request to the separated module [#121](https://github.com/phalcon/cphalcon/issues/121), [#12417](https://github.com/phalcon/cphalcon/issues/12417)
- Added `dispatcher::beforeForward` event to allow forwarding request to the separated module [#121](https://github.com/phalcon/cphalcon/issues/121), [#12417](https://github.com/phalcon/cphalcon/issues/12417), [#2496](https://github.com/phalcon/cphalcon/issues/2496), [#1658](https://github.com/phalcon/cphalcon/issues/1658)

- Added `Phalcon\Security\Random:base62` to provide the largest value that can safely be used in URLs without needing to take extra characters into consideration [#12105](https://github.com/phalcon/cphalcon/issues/12105)
- Added `Phalcon\Assets\ResourceInterface`. So now `Phalcon\Assets\Inline` and `Phalcon\Assets\Resource` implements `ResourceInterface`
- Added `Phalcon\Assets\Collection::has` to checks whether the resource is added to the collection or not
Expand Down Expand Up @@ -503,7 +507,7 @@ belongs to the uniqueId or the whole session data
- Updated Phalcon\Queue\Beanstalk\Job::touch comment
- Fixed use columns as referenced columns in mysql createTable() reference...
- [#2414](https://github.com/phalcon/cphalcon/issues/2414) - Removed check for DBG in session/adapter
- Updated Model::__set
- Updated `Model::__set`
- [#1989](https://github.com/phalcon/cphalcon/issues/1989) Supported \Phalcon\Db\Index: TYPE
- Updated Phalcon\Mvc\Model\Query\Builder::groupBy
- Validation, setDefaultMessages fix
Expand Down Expand Up @@ -591,7 +595,7 @@ belongs to the uniqueId or the whole session data
- Security fixes:
- Hardening fixes ([#1044](https://github.com/phalcon/cphalcon/issues/1044))
- Interface validation ([#1043](https://github.com/phalcon/cphalcon/issues/1043), [#1048](https://github.com/phalcon/cphalcon/issues/1048))
- Thorough data validation in __wakeup() ([#1043](https://github.com/phalcon/cphalcon/issues/1043), [#1634](https://github.com/phalcon/cphalcon/issues/1634), [#1635](https://github.com/phalcon/cphalcon/issues/1635))
- Thorough data validation in `__wakeup()` ([#1043](https://github.com/phalcon/cphalcon/issues/1043), [#1634](https://github.com/phalcon/cphalcon/issues/1634), [#1635](https://github.com/phalcon/cphalcon/issues/1635))
- Fixed XSS vulnerabilities ([#1216](https://github.com/phalcon/cphalcon/issues/1216), [#1190](https://github.com/phalcon/cphalcon/issues/1190))
- Phalcon\Security::checkHash() allows to restrict the length of the password to avoid attacks like https://www.djangoproject.com/weblog/2013/sep/15/security/ ([#1261](https://github.com/phalcon/cphalcon/issues/1261))
- Fixed crash while rendering element's label ([#1210](https://github.com/phalcon/cphalcon/issues/1210))
Expand Down Expand Up @@ -862,10 +866,10 @@ belongs to the uniqueId or the whole session data
- Add remove() to Phalcon\Session\BagInterface ([#1917](https://github.com/phalcon/cphalcon/issues/1917))
- Phalcon\Session\Adapter::get() may optionally remove the data from session ([#1358](https://github.com/phalcon/cphalcon/issues/1358))
- Phalcon\Session\Adapter optimizations ([#1624](https://github.com/phalcon/cphalcon/issues/1624))
- Phalcon\Session\Adapter::__destruct() now calls session_write_close() ([#1624](https://github.com/phalcon/cphalcon/issues/1624))
- `Phalcon\Session\Adapter::__destruct` now calls session_write_close() ([#1624](https://github.com/phalcon/cphalcon/issues/1624))
- Phalcon\Session\AdapterInterface is compatible with SessionHandlerInterface ([#1108](https://github.com/phalcon/cphalcon/issues/1108))
- Phalcon\Session\Adapter now implements Phalcon\Session\AdapterInterface ([#1852](https://github.com/phalcon/cphalcon/issues/1852))
- Phalcon\Session\Bag::__get() now returns by reference (unlike get()) ([#1895](https://github.com/phalcon/cphalcon/issues/1895))
- `Phalcon\Session\Bag::__get` now returns by reference (unlike get()) ([#1895](https://github.com/phalcon/cphalcon/issues/1895))
- Phalcon\Session\Bag implements ArrayAccess, Countable, IteratorAggregate interfaces ([#1917](https://github.com/phalcon/cphalcon/issues/1917))
- Phalcon\Session\Adapter implements ArrayAccess, Countable, IteratorAggregate interfaces ([#1917](https://github.com/phalcon/cphalcon/issues/1917))
- Optimized Phalcon\Session\Adapter using object handlers ([#1917](https://github.com/phalcon/cphalcon/issues/1917))
Expand Down Expand Up @@ -908,8 +912,8 @@ belongs to the uniqueId or the whole session data
- Phalcon\Security::checkHash() now correctly handles non-bcrypt hashes ([#1912](https://github.com/phalcon/cphalcon/issues/1912))

# [1.2.5](https://github.com/phalcon/cphalcon/releases/tag/phalcon-v1.2.5) (2014-01-13)
- Http\Cookie::__toString() will not throw exceptions ([#1427](https://github.com/phalcon/cphalcon/issues/1427))
- Phalcon\Http\Cookie::__toString() will return a string value ([#1428](https://github.com/phalcon/cphalcon/issues/1428))
- `Phalcon\Http\Cookie::__toString` will not throw exceptions ([#1427](https://github.com/phalcon/cphalcon/issues/1427))
- `Phalcon\Http\Cookie::__toString` will return a string value ([#1428](https://github.com/phalcon/cphalcon/issues/1428))
- Camelize does not ignore the last character of a string anymore ([#1436](https://github.com/phalcon/cphalcon/issues/1436))
- APC tests do not run under CLI when apc.enable_cli is 0 ([#1449](https://github.com/phalcon/cphalcon/issues/1449))
- Phalcon\Debug::uri now supports both http and https ([#987](https://github.com/phalcon/cphalcon/issues/987))
Expand All @@ -928,7 +932,7 @@ belongs to the uniqueId or the whole session data
- Bug fix: no arguments were passed to beforeMatch handler in Phalcon\Mvc\Router ([#1556](https://github.com/phalcon/cphalcon/issues/1556))
- Phalcon\Logger\Adapter::setLogLevel() is honored by transactions ([#1716](https://github.com/phalcon/cphalcon/issues/1716))
- Bug fixes in Phalcon\Db\Adapter\Pdo::describeColumns() ([#1562](https://github.com/phalcon/cphalcon/issues/1562))
- Phalcon\Session\Adapter::__destruct() now calls session_write_close() ([#1624](https://github.com/phalcon/cphalcon/issues/1624))
- `Phalcon\Session\Adapter::__destruct` now calls session_write_close() ([#1624](https://github.com/phalcon/cphalcon/issues/1624))
- Volt: fixed bug in email_filed() ([#1723](https://github.com/phalcon/cphalcon/issues/1723))
- Fixed PHP Notices in Phalcon\Debug::onUncaughtException() ([#1683](https://github.com/phalcon/cphalcon/issues/1683))
- Phalcon\Logger\Adapter::commit() clears the queue ([#1748](https://github.com/phalcon/cphalcon/issues/1748))
Expand All @@ -954,8 +958,8 @@ belongs to the uniqueId or the whole session data
- Redirects use status descriptions from RFC 2616 ([#1175](https://github.com/phalcon/cphalcon/issues/1175))
- \Phalcon\Config::merge now works with derived classes ([#1024](https://github.com/phalcon/cphalcon/issues/1024))
- \Phalcon\Security::checkHash() allows to restrict the length of the password to avoid attacks like https://www.djangoproject.com/weblog/2013/sep/15/security/
- \Phalcon\Config can now be cloned ([#1277](https://github.com/phalcon/cphalcon/issues/1277))
- \Phalcon\Mvc\Query\Builder::__construct() ignores joins ([#1327](https://github.com/phalcon/cphalcon/issues/1327))
- `Phalcon\Config` can now be cloned ([#1277](https://github.com/phalcon/cphalcon/issues/1277))
- `Phalcon\Mvc\Query\Builder::__construct` ignores joins ([#1327](https://github.com/phalcon/cphalcon/issues/1327))
- Bug with a custom Events Manager in Phalcon\Mvc\Models ([#1314](https://github.com/phalcon/cphalcon/issues/1314))
- Micro Collections return Phalcon\Mvc\Micro\CollectionInterface ([#1130](https://github.com/phalcon/cphalcon/issues/1130))
- \Phalcon\Forms\Form::getMessages() does not generate a fatal error if the form is valid ([#1349](https://github.com/phalcon/cphalcon/issues/1349))
Expand All @@ -964,7 +968,7 @@ belongs to the uniqueId or the whole session data
- Fixed HAVING handling in Phalcon\Mvc\QueryBuilder ([#1396](https://github.com/phalcon/cphalcon/issues/1396))
- Bug fixes in \Phalcon\Logger\{Adapter,Formatter}\FirePhp ([#1333](https://github.com/phalcon/cphalcon/issues/1333))
- Bug fixes in Phalcon\Cache\Backend\Xcache ([#1406](https://github.com/phalcon/cphalcon/issues/1406))
- Phalcon\Forms\Element::__toString() does not throw exceptions anymore ([#1413](https://github.com/phalcon/cphalcon/issues/1413))
- `Phalcon\Forms\Element::__toString` does not throw exceptions anymore ([#1413](https://github.com/phalcon/cphalcon/issues/1413))
- Other bug fixes ([#947](https://github.com/phalcon/cphalcon/issues/947), [#1131](https://github.com/phalcon/cphalcon/issues/1131), [#1040](https://github.com/phalcon/cphalcon/issues/1040), [#1275](https://github.com/phalcon/cphalcon/issues/1275), [#1392](https://github.com/phalcon/cphalcon/issues/1392), [#1396](https://github.com/phalcon/cphalcon/issues/1396), [#1399](https://github.com/phalcon/cphalcon/issues/1399), backported patches from 1.3.0 etc)

# [1.2.3](https://github.com/phalcon/cphalcon/releases/tag/phalcon-v1.2.3) (2013-08-16)
Expand Down
29 changes: 16 additions & 13 deletions phalcon/db/adapter/pdo/postgresql.zep
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,22 @@ class Postgresql extends PdoAdapter
definition["isNumeric"] = true,
definition["size"] = numericSize,
definition["bindType"] = Column::BIND_PARAM_INT;
} elseif memstr(columnType, "double precision") {
/**
* Double Precision
*/
let definition["type"] = Column::TYPE_DOUBLE,
definition["isNumeric"] = true,
definition["size"] = numericSize,
definition["bindType"] = Column::BIND_PARAM_DECIMAL;
} elseif memstr(columnType, "real") {
/**
* Real
*/
let definition["type"] = Column::TYPE_FLOAT,
definition["isNumeric"] = true,
definition["size"] = numericSize,
definition["bindType"] = Column::BIND_PARAM_DECIMAL;
} elseif memstr(columnType, "varying") {
/**
* Varchar
Expand Down Expand Up @@ -173,12 +189,6 @@ class Postgresql extends PdoAdapter
*/
let definition["type"] = Column::TYPE_CHAR,
definition["size"] = charSize;
} elseif memstr(columnType, "timestamp") {
/**
* Date
*/
let definition["type"] = Column::TYPE_DATETIME,
definition["size"] = 0;
} elseif memstr(columnType, "text") {
/**
* Text are varchars
Expand Down Expand Up @@ -223,13 +233,6 @@ class Postgresql extends PdoAdapter
let definition["type"] = Column::TYPE_VARCHAR;
}

/**
* Check if the column is unsigned, only MySQL support this
*/
if memstr(columnType, "unsigned") {
let definition["unsigned"] = true;
}

/**
* Positions
*/
Expand Down
17 changes: 13 additions & 4 deletions phalcon/paginator/adapter/querybuilder.zep
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ class QueryBuilder extends Adapter
{
var originalBuilder, builder, totalBuilder, totalPages,
limit, numberPage, number, query, page, before, items, totalQuery,
result, row, rowcount, next, sql, columns, db, hasHaving, hasGroup;
result, row, rowcount, next, sql, columns, db, hasHaving, hasGroup,
model, modelClass, dbService;

let originalBuilder = this->_builder;
let columns = this->_columns;
Expand Down Expand Up @@ -223,9 +224,17 @@ class QueryBuilder extends Adapter
* If we have having perform native count on temp table
*/
if hasHaving {
let sql = totalQuery->getSql();
let db = totalBuilder->getDI()->get("db");
let row = db->fetchOne("SELECT COUNT(*) as \"rowcount\" FROM (" . sql["sql"] . ") as T1", Db::FETCH_ASSOC, sql["bind"]),
let sql = totalQuery->getSql(),
modelClass = builder->_models;

if typeof modelClass == "array" {
let modelClass = array_values(modelClass)[0];
}

let model = new {modelClass}();
let dbService = model->getReadConnectionService();
let db = totalBuilder->getDI()->get(dbService);
let row = db->fetchOne("SELECT COUNT(*) as \"rowcount\" FROM (" . sql["sql"] . ") as T1", Db::FETCH_ASSOC, sql["bind"]),
rowcount = row ? intval(row["rowcount"]) : 0,
totalPages = intval(ceil(rowcount / limit));
} else {
Expand Down

0 comments on commit eb8c441

Please sign in to comment.