[TikiWiki-commits] [Git][tikiwiki/tiki][29.x] [FIX] trackers: Another fix for invalid date values in item history

"luci \(@luciash\) via TikiWiki-cvs" <[email protected]>
Newsgroups gmane.comp.cms.tiki.cvs
Message-ID <6a146548eb1f8_3812eb1f3823090@gitlab-sidekiq-low-urgency-cpu-bound-v2-d7f87744c-j4b6k.mail>

luci pushed to branch 29.x at Tiki Wiki CMS Groupware / Tiki


Commits:
c20d2d5e by luci at 2026-05-25T15:04:58+00:00
[FIX] trackers: Another fix for invalid date values in item history
---
* [FIX] trackers: Similar fix to !8744 but for a slightly different edge case, where a non-numeric value has been stored in a linked field in the item history. It was failing without rendering the historical data available which could help with debugging and repair.

See merge request tikiwiki/tiki!10278


(cherry picked from commit 36eecbecb09cf74185eed447535422bbd2bd263c)

fbae5c09 [FIX] trackers: Similar fix to !8744 but for a slightly different edge case,...

Co-authored-by: Jonny Bradley <[email protected]>

(cherry picked from commit 3ee0066bb63640e33c1c1b5039fe050999b919ed)

Co-authored-by: Jonny Bradley <[email protected]>
- - - - -


2 changed files:

- lib/core/Tracker/Field/AbstractItemField.php
- lib/trackers/trackerlib.php


Changes:

=====================================
lib/core/Tracker/Field/AbstractItemField.php
=====================================
@@ -234,12 +234,16 @@ abstract class AbstractItemField implements ItemFieldInterface, IndexableInterfa
             if ($this->getConfiguration('type') === 'e' && is_string($old)) {   // category fields need an array input
                 $old = explode(',', $old);
             }
-            $this->definition = array_merge($this->definition, $this->getFieldData([$key => $old]));
-            $this->itemData[$this->getConfiguration('fieldId')] = $old;
-            $old = $this->renderInnerOutput($innerOutputContext);
-            $old = str_replace(['%%%', '<br>', '<br/>'], ["\n", ' ', ' '], $old);
-            $this->definition = $old_definition;
-            $this->itemData[$this->getConfiguration('fieldId')] = $new;
+            try {
+                $this->definition = array_merge($this->definition, $this->getFieldData([$key => $old]));
+                $this->itemData[$this->getConfiguration('fieldId')] = $old;
+                $old = $this->renderInnerOutput($innerOutputContext);
+                $old = str_replace(['%%%', '<br>', '<br/>'], ["\n", ' ', ' '], $old);
+                $this->definition = $old_definition;
+                $this->itemData[$this->getConfiguration('fieldId')] = $new;
+            } catch (\Exception $e) {
+                $old = tr('Error on field #%0: "%1"', $this->getConfiguration('fieldId'), $e->getMessage());
+            }
         }
         $new = $this->renderInnerOutput($innerOutputContext);
         $new = str_replace(['%%%', '<br>', '<br/>'], ["\n", ' ', ' '], $new);


=====================================
lib/trackers/trackerlib.php
=====================================
@@ -6601,8 +6601,12 @@ class TrackerLib extends TikiLib
                 } else {
                     $requestData = $field;
                 }
-                $linkedField = $handler->getFieldData($requestData);
-                $field = array_merge($field, $linkedField);
+                try {
+                    $linkedField = $handler->getFieldData($requestData);
+                    $field = array_merge($field, $linkedField);
+                } catch (Exception $e) {
+                    Feedback::error(tr('Error on linked field %0: %1', $field['fieldId'], $e->getMessage()));
+                }
                 $field['ins_id'] = 'ins_' . $field['fieldId'];
                 if (isset($field['value']) && $field['type'] == 'S') {
                     $item[$field['fieldId']] = $field['value'];



View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/c20d2d5ef4ef4f0eff375fa74ff755d51ae992b4

-- 
View it on GitLab: https://gitlab.com/tikiwiki/tiki/-/commit/c20d2d5ef4ef4f0eff375fa74ff755d51ae992b4
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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.