Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Commit

Permalink
Merge #5941
Browse files Browse the repository at this point in the history
Merge branch 'hotfix/5941' into develop

* hotfix/5941:
  no cast to (int) on limit&offset at Zend\Db\Sql\Select.php
  • Loading branch information
ralphschindler committed Mar 11, 2014
2 parents 1cc2c9d + f83c3b0 commit 9a988d0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions library/Zend/Db/Sql/Select.php
Original file line number Diff line number Diff line change
Expand Up @@ -854,7 +854,7 @@ protected function processLimit(PlatformInterface $platform, DriverInterface $dr
return null;
}

$limit = (int) $this->limit;
$limit = $this->limit;

if ($driver) {
$sql = $driver->formatParameterName('limit');
Expand All @@ -872,7 +872,7 @@ protected function processOffset(PlatformInterface $platform, DriverInterface $d
return null;
}

$offset = (int) $this->offset;
$offset = $this->offset;

if ($driver) {
$parameterContainer->offsetSet('offset', $offset, ParameterContainer::TYPE_INTEGER);
Expand Down
14 changes: 14 additions & 0 deletions tests/ZendTest/Db/Sql/SelectTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1195,6 +1195,19 @@ public function providerData()
$sqlStr46 = 'SELECT SOME_DB_FUNCTION_ONE() AS Expression1, SOME_DB_FUNCTION_TWO() AS "foo"';
$params46 = array();
$internalTests46 = array();

// limit with big offset and limit
$select47 = new Select;
$select47->from('foo')->limit("10000000000000000000")->offset("10000000000000000000");
$sqlPrep47 = 'SELECT "foo".* FROM "foo" LIMIT ? OFFSET ?';
$sqlStr47 = 'SELECT "foo".* FROM "foo" LIMIT \'10000000000000000000\' OFFSET \'10000000000000000000\'';
$params47 = array('limit' => 10000000000000000000, 'offset' => 10000000000000000000);
$internalTests47 = array(
'processSelect' => array(array(array('"foo".*')), '"foo"'),
'processLimit' => array('?'),
'processOffset' => array('?')
);

/**
* $select = the select object
* $sqlPrep = the sql as a result of preparation
Expand Down Expand Up @@ -1252,6 +1265,7 @@ public function providerData()
array($select44, $sqlPrep44, array(), $sqlStr44, $internalTests44),
array($select45, $sqlPrep45, $params45, $sqlStr45, $internalTests45),
array($select46, $sqlPrep46, $params46, $sqlStr46, $internalTests46),
array($select47, $sqlPrep47, $params47, $sqlStr47, $internalTests47),
);
}
}

0 comments on commit 9a988d0

Please sign in to comment.