diff options
| author | 2023-05-22 10:01:43 +0200 | |
|---|---|---|
| committer | 2023-05-22 10:01:43 +0200 | |
| commit | d554d0f6736c5cf94cb2a8fa61f3b6187b86ffa2 (patch) | |
| tree | 71547b1b27ce61b17639358351e2d530c50834ed | |
| parent | 3bdb8976106f6e993b53ba4a20692f0dda621f4f (diff) | |
Avoid falsy guid (#5412)
Whitespace strings, empty strings, 0 are all problematic when working with GUIDs. so avoid them.
| -rw-r--r-- | app/Models/Entry.php | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/app/Models/Entry.php b/app/Models/Entry.php index 70b2fa5f0..9e3e97d1a 100644 --- a/app/Models/Entry.php +++ b/app/Models/Entry.php @@ -432,9 +432,10 @@ HTML; } } public function _guid(string $value): void { - if ($value == '') { + $value = trim($value); + if (empty($value)) { $value = $this->link; - if ($value == '') { + if (empty($value)) { $value = $this->hash(); } } @@ -468,7 +469,7 @@ HTML; } public function _link(string $value): void { $this->hash = ''; - $this->link = $value; + $this->link = trim($value); } /** @param int|string $value */ public function _date($value): void { |
