[TikiWiki-commits] [Git][tikiwiki/tiki][30.x] [FIX] index: Ensure `$data` is checked before processing and report error if missing
"Jonny Bradley \(@jonnybradley\) via TikiWiki-cvs" <[email protected]>
| Newsgroups | gmane.comp.cms.tiki.cvs |
|---|---|
| Message-ID | <6a31439f9fe9c_38c90dd867611@gitlab-sidekiq-low-urgency-cpu-bound-v2-7d87cb8569-pq2vr.mail> |
Jonny Bradley pushed to branch 30.x at Tiki Wiki CMS Groupware / Tiki Commits: 142ae593 by Jonny Bradley at 2026-06-16T12:37:48+00:00 [FIX] index: Ensure `$data` is checked before processing and report error if missing --- * [FIX] index: Ensure `$data` is checked before processing and report error if missing See merge request tikiwiki/tiki!10533 (cherry picked from commit 2b794d016d2e73fdae7afebd296f511b1665d0bb) 153a5345 [FIX] index: Ensure `$data` is checked before processing and report error if missing Co-authored-by: Jonny Bradley <[email protected]> - - - - - 1 changed file: - lib/core/Search/Formatter/DataSource/Declarative.php Changes: ===================================== lib/core/Search/Formatter/DataSource/Declarative.php ===================================== @@ -59,22 +59,25 @@ class Search_Formatter_DataSource_Declarative implements Search_Formatter_DataSo if ($this->sourceProvidesValue($contentSource, $missingFields)) { $data = $contentSource->getDocument($object, new Search_Type_Factory_Direct()); - $used = $data; - if (is_int(key($data)) && ! is_null($hash)) { - $used = reset($data); + if ($data) { + $used = $data; + if (is_int(key($data)) && ! is_null($hash)) { + $used = reset($data); - foreach ($data as $entry) { - if (isset($entry['hash']) && $entry['hash']->getValue() == $hash) { - $used = $entry; - break; + foreach ($data as $entry) { + if (isset($entry['hash']) && $entry['hash']->getValue() == $hash) { + $used = $entry; + break; + } } + } elseif (is_int(key($data))) { + $used = reset($data); } - } elseif (is_int(key($data))) { - $used = reset($data); + return $this->getRaw($used, $missingFields); + } else { + Feedback::error(tr('No data found for %0 %1', $type, $object)); } - - return $this->getRaw($used, $missingFields); } } View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/142ae59341d6bbdec559d1f779afd5ef2719ed5a -- View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/142ae59341d6bbdec559d1f779afd5ef2719ed5a You're receiving this email because of your account on gitlab.com. Manage all notifications: https://gitlab.com/-/profile/notifications | Help: https://gitlab.com/help _______________________________________________ TikiWiki-cvs mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/tikiwiki-cvs