From 1a92f475612c22fb1bd660bfb6a67dc75eb5693d Mon Sep 17 00:00:00 2001 From: venyii Date: Thu, 24 Mar 2016 16:37:06 +0100 Subject: [PATCH] Initialize the aggregation builder stages property with an empty array This will fix a PHP warning when calling `getPipeline()` on an Aggregation builder without any stages since array_map expects an array as second argument, but the `$stages` property is still `null`. The new behaviour is consistent with the Query builder, which also returns an empty array. --- lib/Doctrine/MongoDB/Aggregation/Builder.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Doctrine/MongoDB/Aggregation/Builder.php b/lib/Doctrine/MongoDB/Aggregation/Builder.php index 78564b22..2cfb92a0 100644 --- a/lib/Doctrine/MongoDB/Aggregation/Builder.php +++ b/lib/Doctrine/MongoDB/Aggregation/Builder.php @@ -41,7 +41,7 @@ class Builder /** * @var Stage[] */ - private $stages; + private $stages = array(); /** * Create a new aggregation builder.