Browse Source

Merge pull request #10864 from MCF/php72_count_fix

Stop warnings when using count in QueryCompiler in PHP 7.2
Mark Story 8 years ago
parent
commit
7d5719e50c
1 changed files with 3 additions and 1 deletions
  1. 3 1
      src/Database/QueryCompiler.php

+ 3 - 1
src/Database/QueryCompiler.php

@@ -125,7 +125,9 @@ class QueryCompiler
     protected function _sqlCompiler(&$sql, $query, $generator)
     {
         return function ($parts, $name) use (&$sql, $query, $generator) {
-            if (!count($parts)) {
+            if (!isset($parts) ||
+                ((is_array($parts) || $parts instanceof \Countable) && !count($parts))
+            ) {
                 return;
             }
             if ($parts instanceof ExpressionInterface) {