Skip to content
Snippets Groups Projects
Unverified Commit 68cd2e55 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #2932777 by mondrake, borisson_, alexpott, daffie: Risky count() in SQLite Statement

parent 0daa2b52
No related branches found
No related tags found
No related merge requests found
...@@ -27,7 +27,7 @@ class Statement extends StatementPrefetch implements StatementInterface { ...@@ -27,7 +27,7 @@ class Statement extends StatementPrefetch implements StatementInterface {
* See http://bugs.php.net/bug.php?id=45259 for more details. * See http://bugs.php.net/bug.php?id=45259 for more details.
*/ */
protected function getStatement($query, &$args = []) { protected function getStatement($query, &$args = []) {
if (count($args)) { if (is_array($args) && !empty($args)) {
// Check if $args is a simple numeric array. // Check if $args is a simple numeric array.
if (range(0, count($args) - 1) === array_keys($args)) { if (range(0, count($args) - 1) === array_keys($args)) {
// In that case, we have unnamed placeholders. // In that case, we have unnamed placeholders.
......
...@@ -44,7 +44,7 @@ interface StatementInterface extends \Traversable { ...@@ -44,7 +44,7 @@ interface StatementInterface extends \Traversable {
* *
* @param $args * @param $args
* An array of values with as many elements as there are bound parameters in * An array of values with as many elements as there are bound parameters in
* the SQL statement being executed. * the SQL statement being executed. This can be NULL.
* @param $options * @param $options
* An array of options for this query. * An array of options for this query.
* *
......
...@@ -214,8 +214,8 @@ protected function throwPDOException() { ...@@ -214,8 +214,8 @@ protected function throwPDOException() {
* *
* @param $query * @param $query
* The query. * The query.
* @param array $args * @param array|null $args
* An array of arguments. * An array of arguments. This can be NULL.
* @return \PDOStatement * @return \PDOStatement
* A PDOStatement object. * A PDOStatement object.
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment