Fixes #27. Serialize empty textures as an object

This commit is contained in:
ErickSkrauch
2022-12-05 22:50:22 +01:00
parent 26b2168ae3
commit b113beb78e
4 changed files with 40 additions and 2 deletions

View File

@@ -3,6 +3,7 @@ declare(strict_types=1);
namespace common\models;
use ArrayObject;
use Carbon\Carbon;
use common\components\SkinsSystemApi;
use GuzzleHttp\Client as GuzzleHttpClient;
@@ -22,7 +23,7 @@ class Textures {
$profile = $this->getProfile($signed);
if ($profile === null) {
// This case shouldn't happen at all, but synchronization isn't perfect and sometimes
// information might be now updated. Provide fallback solution
// information might be not updated. Provide fallback solution
$profile = [
'name' => $this->account->username,
'id' => $uuid,
@@ -33,7 +34,7 @@ class Textures {
'timestamp' => Carbon::now()->getPreciseTimestamp(3),
'profileId' => $uuid,
'profileName' => $this->account->username,
'textures' => [],
'textures' => new ArrayObject(), // Force {} rather than [] when json_encode
])),
],
[

View File

@@ -233,4 +233,21 @@ return [
'password_changed_at' => 1591893532,
'deleted_at' => time(),
],
'not-synchronized-on-chrly-account' => [
'id' => 16,
'uuid' => '7ff4a9dc-d177-4ea0-ab56-7f31218004f9',
'username' => 'NotSynchronized',
'email' => 'not-synchronized@ely.by',
'password_hash' => '$2y$13$2rYkap5T6jG8z/mMK8a3Ou6aZxJcmAaTha6FEuujvHEmybSHRzW5e', # password_0
'password_hash_strategy' => \common\models\Account::PASS_HASH_STRATEGY_YII2,
'lang' => 'ru',
'status' => \common\models\Account::STATUS_ACTIVE,
'rules_agreement_version' => \common\LATEST_RULES_VERSION,
'otp_secret' => null,
'is_otp_enabled' => false,
'created_at' => 1670264178,
'updated_at' => 1670264178,
'password_changed_at' => 1670264178,
'deleted_at' => null,
],
];