UTF8 decoding needs to be done after casting

This commit is contained in:
Deon George 2022-11-05 15:17:00 +11:00
parent 531654724a
commit 584b988093

View File

@ -82,8 +82,11 @@ trait EncodeUTF8
public function getAttribute($key)
{
if (in_array($key,self::cast_utf8) && Arr::get($this->attributes,$key) && (! Arr::get($this->_encoded,$key))) {
$this->attributes[$key] = utf8_decode($this->attributes[$key]);
// We need to get it from the parent first, taking into account any casting
$this->attributes[$key] = utf8_decode(parent::getAttribute($key));
$this->_encoded[$key] = TRUE;
return $this->attributes[$key];
}
return parent::getAttribute($key);