aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2023-05-22 10:01:43 +0200
committerGravatar GitHub <noreply@github.com> 2023-05-22 10:01:43 +0200
commitd554d0f6736c5cf94cb2a8fa61f3b6187b86ffa2 (patch)
tree71547b1b27ce61b17639358351e2d530c50834ed
parent3bdb8976106f6e993b53ba4a20692f0dda621f4f (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.php7
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 {