Skip to content

Commit f1f940d

Browse files
committed
use JSON_UNESCAPED_UNICODE and JSON_UNESCAPED_SLASHES with json_encode
1 parent f6b1974 commit f1f940d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

system/Entity/Entity.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ public function syncOriginal()
282282

283283
foreach ($this->attributes as $key => $value) {
284284
if (is_object($value) || is_array($value)) {
285-
$this->original[$key] = json_encode($this->normalizeValue($value));
285+
$this->original[$key] = json_encode($this->normalizeValue($value), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
286286
$this->_onlyScalars = false;
287287
} else {
288288
$this->original[$key] = $value;
@@ -338,7 +338,7 @@ public function hasChanged(?string $key = null): bool
338338

339339
// If original is a string, it was JSON-encoded (object or array)
340340
if (is_string($originalValue) && (is_object($currentValue) || is_array($currentValue))) {
341-
return $originalValue !== json_encode($this->normalizeValue($currentValue));
341+
return $originalValue !== json_encode($this->normalizeValue($currentValue), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
342342
}
343343

344344
// For scalars, use direct comparison

0 commit comments

Comments
 (0)