From 48f3db2b0c19479f529dd13e3c0f2ba0f036fe72 Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Sun, 16 Jan 2022 12:43:04 -0500 Subject: [PATCH] Fix issue where findRaw could get error when returning referencs where none existed --- wire/core/PagesRaw.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wire/core/PagesRaw.php b/wire/core/PagesRaw.php index 0f4649f0..94052d98 100644 --- a/wire/core/PagesRaw.php +++ b/wire/core/PagesRaw.php @@ -952,6 +952,7 @@ class PagesRawFinder extends Wire { $this->ids(true); // converts this->ids to CSV string $idsCSV = &$this->ids; + if(empty($idsCSV)) return; $colSQL = $getAllCols ? '*' : '`' . implode('`,`', $getCols) . '`'; if(!$getAllCols && !in_array('pages_id', $getCols)) $colSQL .= ',`pages_id`'; @@ -1282,10 +1283,14 @@ class PagesRawFinder extends Wire { $database = $this->wire()->database; $pageFields = array(); + if(empty($this->ids)) return; + foreach($this->wire()->fields as $field) { if($field->type instanceof FieldtypePage) $pageFields[$field->name] = $field; } + if(empty($pageFields)) return; + foreach($this->values as $id => $data) { $this->values[$id]['references'] = array(); }