summaryrefslogtreecommitdiffstats
path: root/src/Components/CaseExpression.php
diff options
context:
space:
mode:
authorThomas Gerbet <thomas@gerbet.me>2019-04-10 22:51:51 +0200
committerThomas Gerbet <thomas@gerbet.me>2019-04-10 23:12:31 +0200
commitb47e27b8724cb2639cccec9430076ef8a68c869c (patch)
tree6a4ff6c9d796b77f14b7112f87f706e16b4523ae /src/Components/CaseExpression.php
parent9f088cd04b29665db0a1ffd138130a1437fe07b1 (diff)
downloadsql-parser-b47e27b8724cb2639cccec9430076ef8a68c869c.zip
sql-parser-b47e27b8724cb2639cccec9430076ef8a68c869c.tar.gz
sql-parser-b47e27b8724cb2639cccec9430076ef8a68c869c.tar.bz2
Fix PHP warnings when building an incomplete CASE expression
Issue can be reproduced with the following code snippet: ```php new \PhpMyAdmin\SqlParser\Parser('SELECT a CASE'); // PHP Warning: count(): Parameter must be an array or an object that implements Countable in src/Components/CaseExpression.php on line 296 // PHP Warning: count(): Parameter must be an array or an object that implements Countable in src/Components/CaseExpression.php on line 297 ```
Diffstat (limited to 'src/Components/CaseExpression.php')
-rw-r--r--src/Components/CaseExpression.php6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Components/CaseExpression.php b/src/Components/CaseExpression.php
index a79b52e..309f0ff 100644
--- a/src/Components/CaseExpression.php
+++ b/src/Components/CaseExpression.php
@@ -33,21 +33,21 @@ class CaseExpression extends Component
*
* @var array
*/
- public $conditions;
+ public $conditions = [];
/**
* The results matching with the WHEN clauses.
*
* @var array
*/
- public $results;
+ public $results = [];
/**
* The values to be compared against.
*
* @var array
*/
- public $compare_values;
+ public $compare_values = [];
/**
* The result in ELSE section of expr.