This repository has been archived by the owner on Jan 8, 2020. It is now read-only.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$sql = $platform->quoteValue($this->limit); | ||
if (is_int($this->limit)) { | ||
$sql = $this->limit; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
coding standards - put the else on the same line as the closing brackets and check indentations of all your lines please
Check for "!is_int()" and throw an exception - that will simplify the logic and remove the need for an else block. |
This not a good fix. You're probably experiencing this problem on MySQL, which is the only platform that does not accept quoted values for LIMIT and OFFSET. It is more correct for them to be quoted in terms of a valid abstraction. A better fix for this is to create SQL abstraction for this situation, which can't be done in time for 2.0. |
weierophinney
added a commit
that referenced
this pull request
Oct 16, 2012
ghost
assigned ralphschindler
Oct 16, 2012
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixed invalid quoting of LIMIT and OFFSET clauses in getSqlStringForSqlObject() as described in http://framework.zend.com/issues/browse/ZF2-503.
The solution works and I believe it does the same thing that was intended with quoteValue() (stopping injections), but it now returns a valid SQL statement. However I'm unsure if throwing an exception like that is expected behaviour so let me know if it's no good.