diff --git a/src/AddToCampaignHandler.php b/src/AddToCampaignHandler.php index 7c03f6d6..746fe853 100644 --- a/src/AddToCampaignHandler.php +++ b/src/AddToCampaignHandler.php @@ -134,7 +134,7 @@ protected function getAvailableChangeSets() */ protected function getInChangeSets($object) { - $inChangeSetIDs = array_unique(ChangeSetItem::get_for_object($object)->column('ChangeSetID')); + $inChangeSetIDs = array_unique(ChangeSetItem::get_for_object($object)->column('ChangeSetID') ?: []); if ($inChangeSetIDs > 0) { $changeSets = $this->getAvailableChangeSets()->filter([ 'ID' => $inChangeSetIDs, diff --git a/src/CampaignAdmin.php b/src/CampaignAdmin.php index 7686cd12..40910ef5 100644 --- a/src/CampaignAdmin.php +++ b/src/CampaignAdmin.php @@ -205,7 +205,7 @@ protected function getPlaceholderGroups() $classes = Config::inst()->get(ChangeSet::class, 'important_classes'); foreach ($classes as $class) { - if (!class_exists($class)) { + if (!class_exists((string) $class)) { continue; } /** @var DataObject $item */ @@ -441,7 +441,7 @@ public function readCampaign(HTTPRequest $request) $accepts = $request->getAcceptMimetypes(); //accept 'text/json' for legacy reasons - if (in_array('application/json', $accepts) || in_array('text/json', $accepts)) { + if (in_array('application/json', $accepts ?: []) || in_array('text/json', $accepts ?: [])) { $response->addHeader('Content-Type', 'application/json'); if (!$request->param('Name')) { return (new HTTPResponse(null, 400)); diff --git a/tests/behat/src/FixtureContext.php b/tests/behat/src/FixtureContext.php index e332c677..623e6f32 100644 --- a/tests/behat/src/FixtureContext.php +++ b/tests/behat/src/FixtureContext.php @@ -180,7 +180,7 @@ public function iClickTheGalleryItem($name) public function iSeeTheCampaignItem($negate, $name) { $item = $this->getCampaignItem($name); - $shouldSee = !trim($negate); + $shouldSee = !trim((string) $negate); if ($shouldSee) { Assert::assertNotNull($item, sprintf('Item "%s" could not be found', $name)); @@ -219,7 +219,7 @@ public function stepCreateCampaignWithItems($id, $data) preg_match_all( '/"(?[^"]+)"\s*=\s*"(?[^"]+)"/', - $data, + (string) $data, $matches ); $itemMap = array_combine($matches['content_class'], $matches['identifier']);