Fix for single encoding error, when only the first message was decoded, some logging for Address objects
This commit is contained in:
@@ -9,6 +9,8 @@ use Illuminate\Support\Arr;
|
||||
|
||||
trait EncodeUTF8
|
||||
{
|
||||
private array $_encoded = []; // Remember what we've decoded - when calling getAttribute()
|
||||
|
||||
private function decode(array $values): void
|
||||
{
|
||||
$properties = (new \ReflectionClass($this))->getProperties();
|
||||
@@ -79,11 +81,9 @@ trait EncodeUTF8
|
||||
|
||||
public function getAttribute($key)
|
||||
{
|
||||
static $encoded = [];
|
||||
|
||||
if (in_array($key,self::cast_utf8) && Arr::get($this->attributes,$key) && (! Arr::get($encoded,$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]);
|
||||
$encoded[$key] = TRUE;
|
||||
$this->_encoded[$key] = TRUE;
|
||||
}
|
||||
|
||||
return parent::getAttribute($key);
|
||||
|
Reference in New Issue
Block a user